Commit 2308ab7a authored by Elias Werberich's avatar Elias Werberich Committed by Douwe Maan

'Assigned Issues' and 'Assigned Merge Requests' as dashboard user choices

parent 463fe406
......@@ -42,6 +42,10 @@ class RootController < Dashboard::ProjectsController
redirect_to(dashboard_groups_path)
when 'todos'
redirect_to(dashboard_todos_path)
when 'issues'
redirect_to(issues_dashboard_path(assignee_id: current_user.id))
when 'merge_requests'
redirect_to(merge_requests_dashboard_path(assignee_id: current_user.id))
end
end
......
......@@ -9,12 +9,14 @@ module PreferencesHelper
# Maps `dashboard` values to more user-friendly option text
DASHBOARD_CHOICES = {
projects: 'Your Projects (default)',
stars: 'Starred Projects',
project_activity: "Your Projects' Activity",
starred_project_activity: "Starred Projects' Activity",
groups: "Your Groups",
todos: "Your Todos"
projects: _("Your Projects (default)"),
stars: _("Starred Projects"),
project_activity: _("Your Projects' Activity"),
starred_project_activity: _("Starred Projects' Activity"),
groups: _("Your Groups"),
todos: _("Your Todos"),
issues: _("Assigned Issues"),
merge_requests: _("Assigned Merge Requests")
}.with_indifferent_access.freeze
# Returns an Array usable by a select field for more user-friendly option text
......
......@@ -187,7 +187,7 @@ class User < ActiveRecord::Base
# User's Dashboard preference
# Note: When adding an option, it MUST go on the end of the array.
enum dashboard: [:projects, :stars, :project_activity, :starred_project_activity, :groups, :todos]
enum dashboard: [:projects, :stars, :project_activity, :starred_project_activity, :groups, :todos, :issues, :merge_requests]
# User's Project preference
# Note: When adding an option, it MUST go on the end of the array.
......
---
title: Add 'Assigned Issues' and 'Assigned Merge Requests' as dashboard view choices for users
merge_request: 17860
author: Elias Werberich
type: added
......@@ -41,7 +41,7 @@ select few, the amount of activity on the default Dashboard page can be
overwhelming. Changing this setting allows you to redefine what your default
dashboard will be.
You have 6 options here that you can use for your default dashboard view:
You have 8 options here that you can use for your default dashboard view:
- Your projects (default)
- Starred projects
......@@ -49,6 +49,8 @@ You have 6 options here that you can use for your default dashboard view:
- Starred projects' activity
- Your groups
- Your [Todos]
- Assigned Issues
- Assigned Merge Requests
### Project home page content
......
......@@ -90,6 +90,30 @@ describe RootController do
end
end
context 'who has customized their dashboard setting for assigned issues' do
before do
user.dashboard = 'issues'
end
it 'redirects to their assigned issues' do
get :index
expect(response).to redirect_to issues_dashboard_path(assignee_id: user.id)
end
end
context 'who has customized their dashboard setting for assigned merge requests' do
before do
user.dashboard = 'merge_requests'
end
it 'redirects to their assigned merge requests' do
get :index
expect(response).to redirect_to merge_requests_dashboard_path(assignee_id: user.id)
end
end
context 'who uses the default dashboard setting' do
it 'renders the default dashboard' do
get :index
......
......@@ -21,7 +21,9 @@ describe PreferencesHelper do
["Your Projects' Activity", 'project_activity'],
["Starred Projects' Activity", 'starred_project_activity'],
["Your Groups", 'groups'],
["Your Todos", 'todos']
["Your Todos", 'todos'],
["Assigned Issues", 'issues'],
["Assigned Merge Requests", 'merge_requests']
]
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment