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
e1dcf71a
Commit
e1dcf71a
authored
Dec 10, 2019
by
Corinna Wiesner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Is using seat badge to user overview in the admin panel
parent
a476939c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
2 deletions
+56
-2
ee/app/helpers/ee/users_helper.rb
ee/app/helpers/ee/users_helper.rb
+10
-0
ee/spec/helpers/users_helper_spec.rb
ee/spec/helpers/users_helper_spec.rb
+43
-2
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
ee/app/helpers/ee/users_helper.rb
View file @
e1dcf71a
...
...
@@ -10,6 +10,16 @@ module EE
new_trial_registration_path
end
def
user_badges_in_admin_section
(
user
)
super
(
user
).
tap
do
|
badges
|
if
user
.
using_license_seat?
it_s_you_index
=
badges
.
index
{
|
badge
|
badge
[
:text
]
==
"It's you!"
}
||
-
1
badges
.
insert
(
it_s_you_index
,
{
text:
s_
(
'AdminUsers|Is using seat'
),
variant:
'light'
})
end
end
end
private
def
trials_allowed?
(
user
)
...
...
ee/spec/helpers/users_helper_spec.rb
View file @
e1dcf71a
...
...
@@ -3,9 +3,9 @@
require
'spec_helper'
describe
UsersHelper
do
describe
'#current_user_menu_items'
do
let
(
:user
)
{
create
(
:user
)
}
describe
'#current_user_menu_items'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
...
...
@@ -32,4 +32,45 @@ describe UsersHelper do
it
{
is_expected
.
to
eq
(
expected_result
)
}
end
end
describe
'#user_badges_in_admin_section'
do
subject
{
helper
.
user_badges_in_admin_section
(
user
)
}
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
build
(
:user
))
end
context
'with user who is using a license seat'
do
before
do
allow
(
user
).
to
receive
(
:using_license_seat?
).
and_return
(
true
)
end
context
'when user is an admin and the current_user'
do
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
user
).
to
receive
(
:admin?
).
and_return
(
true
)
end
it
do
expect
(
subject
).
to
eq
(
[
{
text:
'Admin'
,
variant:
'success'
},
{
text:
'Is using seat'
,
variant:
'light'
},
{
text:
"It's you!"
,
variant:
nil
}
]
)
end
end
it
{
expect
(
subject
).
to
eq
([
text:
'Is using seat'
,
variant:
'light'
])
}
end
context
'with user who is not using a license seat'
do
before
do
allow
(
user
).
to
receive
(
:using_license_seat?
).
and_return
(
false
)
end
it
{
expect
(
subject
).
to
eq
([])
}
end
end
end
locale/gitlab.pot
View file @
e1dcf71a
...
...
@@ -1338,6 +1338,9 @@ msgstr ""
msgid "AdminUsers|External"
msgstr ""
msgid "AdminUsers|Is using seat"
msgstr ""
msgid "AdminUsers|It's you!"
msgstr ""
...
...
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