Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
0383afc6
Commit
0383afc6
authored
Sep 25, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add user preference to view project activity and starred project activity as default dashboard
Closes #2662
parent
6d691810
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
5 deletions
+38
-5
CHANGELOG
CHANGELOG
+1
-0
app/controllers/root_controller.rb
app/controllers/root_controller.rb
+4
-0
app/helpers/preferences_helper.rb
app/helpers/preferences_helper.rb
+3
-1
app/models/user.rb
app/models/user.rb
+1
-1
spec/controllers/root_controller_spec.rb
spec/controllers/root_controller_spec.rb
+23
-1
spec/helpers/preferences_helper_spec.rb
spec/helpers/preferences_helper_spec.rb
+6
-2
No files found.
CHANGELOG
View file @
0383afc6
Please view this file on the master branch, on stable branches it's out of date.
v 8.1.0 (unreleased)
- Add user preference to view activities as default dashboard (Stan Hu)
- Fix bug where projects would appear to be stuck in the forked import state (Stan Hu)
- Fix Error 500 in creating merge requests with > 1000 diffs (Stan Hu)
- Show CI status on all pages where commits list is rendered
...
...
app/controllers/root_controller.rb
View file @
0383afc6
...
...
@@ -22,6 +22,10 @@ class RootController < Dashboard::ProjectsController
when
'stars'
flash
.
keep
redirect_to
starred_dashboard_projects_path
when
'project_activity'
redirect_to
activity_dashboard_path
when
'starred_project_activity'
redirect_to
activity_dashboard_path
(
filter:
'starred'
)
else
return
end
...
...
app/helpers/preferences_helper.rb
View file @
0383afc6
...
...
@@ -3,7 +3,9 @@ module PreferencesHelper
# Maps `dashboard` values to more user-friendly option text
DASHBOARD_CHOICES
=
{
projects:
'Your Projects (default)'
,
stars:
'Starred Projects'
stars:
'Starred Projects'
,
project_activity:
"Your Projects' Activity"
,
starred_project_activity:
"Starred Projects' Activity"
}.
with_indifferent_access
.
freeze
# Returns an Array usable by a select field for more user-friendly option text
...
...
app/models/user.rb
View file @
0383afc6
...
...
@@ -172,7 +172,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
]
enum
dashboard:
[
:projects
,
:stars
,
:project_activity
,
:starred_project_activity
]
# User's Project preference
# Note: When adding an option, it MUST go on the end of the array.
...
...
spec/controllers/root_controller_spec.rb
View file @
0383afc6
...
...
@@ -10,7 +10,7 @@ describe RootController do
allow
(
subject
).
to
receive
(
:current_user
).
and_return
(
user
)
end
context
'who has customized their dashboard setting'
do
context
'who has customized their dashboard setting
for starred projects
'
do
before
do
user
.
update_attribute
(
:dashboard
,
'stars'
)
end
...
...
@@ -21,6 +21,28 @@ describe RootController do
end
end
context
'who has customized their dashboard setting for project activities'
do
before
do
user
.
update_attribute
(
:dashboard
,
'project_activity'
)
end
it
'redirects to the activity list'
do
get
:index
expect
(
response
).
to
redirect_to
activity_dashboard_path
end
end
context
'who has customized their dashboard setting for starred project activities'
do
before
do
user
.
update_attribute
(
:dashboard
,
'starred_project_activity'
)
end
it
'redirects to the activity list'
do
get
:index
expect
(
response
).
to
redirect_to
activity_dashboard_path
(
filter:
'starred'
)
end
end
context
'who uses the default dashboard setting'
do
it
'renders the default dashboard'
do
get
:index
...
...
spec/helpers/preferences_helper_spec.rb
View file @
0383afc6
...
...
@@ -8,14 +8,18 @@ describe PreferencesHelper do
end
it
'raises an exception when defined choices may be using the wrong key'
do
expect
(
User
).
to
receive
(
:dashboards
).
and_return
(
foo:
'foo'
,
bar:
'bar'
)
dashboards
=
User
.
dashboards
.
dup
dashboards
[
:projects_changed
]
=
dashboards
.
delete
:projects
expect
(
User
).
to
receive
(
:dashboards
).
and_return
(
dashboards
)
expect
{
helper
.
dashboard_choices
}.
to
raise_error
(
KeyError
)
end
it
'provides better option descriptions'
do
expect
(
helper
.
dashboard_choices
).
to
match_array
[
[
'Your Projects (default)'
,
'projects'
],
[
'Starred Projects'
,
'stars'
]
[
'Starred Projects'
,
'stars'
],
[
"Your Projects' Activity"
,
'project_activity'
],
[
"Starred Projects' Activity"
,
'starred_project_activity'
]
]
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment