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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
c1908746
Commit
c1908746
authored
Aug 07, 2018
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make roadmap_layout lowercase
parent
0982bb4e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
11 deletions
+14
-11
ee/app/controllers/groups/roadmap_controller.rb
ee/app/controllers/groups/roadmap_controller.rb
+6
-3
ee/app/helpers/roadmaps_helper.rb
ee/app/helpers/roadmaps_helper.rb
+1
-1
ee/app/models/ee/user.rb
ee/app/models/ee/user.rb
+2
-2
ee/spec/helpers/roadmaps_helper_spec.rb
ee/spec/helpers/roadmaps_helper_spec.rb
+1
-1
ee/spec/models/ee/user_spec.rb
ee/spec/models/ee/user_spec.rb
+2
-2
ee/spec/requests/groups/roadmap_controller_spec.rb
ee/spec/requests/groups/roadmap_controller_spec.rb
+2
-2
No files found.
ee/app/controllers/groups/roadmap_controller.rb
View file @
c1908746
...
...
@@ -12,10 +12,13 @@ module Groups
def
persist_roadmap_layout
return
unless
current_user
return
unless
User
.
roadmap_layouts
[
params
[
:layout
]]
return
if
current_user
.
roadmap_layout
==
params
[
:layout
]
Users
::
UpdateService
.
new
(
current_user
,
user:
current_user
,
roadmap_layout:
params
[
:layout
]).
execute
roadmap_layout
=
params
[
:layout
]
&
.
downcase
return
unless
User
.
roadmap_layouts
[
roadmap_layout
]
return
if
current_user
.
roadmap_layout
==
roadmap_layout
Users
::
UpdateService
.
new
(
current_user
,
user:
current_user
,
roadmap_layout:
roadmap_layout
).
execute
end
end
end
ee/app/helpers/roadmaps_helper.rb
View file @
c1908746
...
...
@@ -2,6 +2,6 @@
module
RoadmapsHelper
def
roadmap_layout
current_user
&
.
roadmap_layout
||
params
[
:layout
].
presence
||
EE
::
User
::
DEFAULT_ROADMAP_LAYOUT
(
current_user
&
.
roadmap_layout
||
params
[
:layout
].
presence
||
EE
::
User
::
DEFAULT_ROADMAP_LAYOUT
).
upcase
end
end
ee/app/models/ee/user.rb
View file @
c1908746
...
...
@@ -7,7 +7,7 @@ module EE
extend
ActiveSupport
::
Concern
include
AuditorUserHelper
DEFAULT_ROADMAP_LAYOUT
=
'
MONTHS
'
.
freeze
DEFAULT_ROADMAP_LAYOUT
=
'
months
'
.
freeze
included
do
EMAIL_OPT_IN_SOURCE_ID_GITLAB_COM
=
1
...
...
@@ -38,7 +38,7 @@ module EE
scope
:excluding_guests
,
->
{
joins
(
:members
).
where
(
'members.access_level > ?'
,
::
Gitlab
::
Access
::
GUEST
).
distinct
}
enum
roadmap_layout:
{
WEEKS
:
1
,
MONTHS
:
4
,
QUARTERS
:
12
}
enum
roadmap_layout:
{
weeks:
1
,
months:
4
,
quarters
:
12
}
end
module
ClassMethods
...
...
ee/spec/helpers/roadmaps_helper_spec.rb
View file @
c1908746
...
...
@@ -28,7 +28,7 @@ describe RoadmapsHelper do
it
'is sourced from User#roadmap_layout'
do
allow
(
helper
).
to
receive
(
:params
).
and_return
(
layout:
'WEEKS'
)
expect
(
user
).
to
receive
(
:roadmap_layout
).
and_return
(
'
QUARTERS
'
)
expect
(
user
).
to
receive
(
:roadmap_layout
).
and_return
(
'
quarters
'
)
expect
(
helper
.
roadmap_layout
).
to
eq
(
'QUARTERS'
)
end
...
...
ee/spec/models/ee/user_spec.rb
View file @
c1908746
...
...
@@ -229,10 +229,10 @@ describe EE::User do
end
context
'set'
do
subject
{
build
(
:user
,
roadmap_layout:
'
QUARTERS
'
)
}
subject
{
build
(
:user
,
roadmap_layout:
'
quarters
'
)
}
it
'returns set value'
do
expect
(
subject
.
roadmap_layout
).
to
eq
(
'
QUARTERS
'
)
expect
(
subject
.
roadmap_layout
).
to
eq
(
'
quarters
'
)
end
end
end
...
...
ee/spec/requests/groups/roadmap_controller_spec.rb
View file @
c1908746
...
...
@@ -51,12 +51,12 @@ describe Groups::RoadmapController do
context
'specifying layout'
do
it
'persists roadmap_layout if different than current layout'
do
expect
(
Users
::
UpdateService
).
to
receive
(
:new
).
with
(
user
,
user:
user
,
roadmap_layout:
layout
).
once
.
and_call_original
expect
(
Users
::
UpdateService
).
to
receive
(
:new
).
with
(
user
,
user:
user
,
roadmap_layout:
layout
.
downcase
).
once
.
and_call_original
expect
do
get
group_roadmap_path
(
group
,
layout:
layout
)
get
group_roadmap_path
(
group
,
layout:
layout
)
end
.
to
change
{
user
.
reload
.
roadmap_layout
}.
to
(
layout
)
end
.
to
change
{
user
.
reload
.
roadmap_layout
}.
to
(
layout
.
downcase
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
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