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
17b99900
Commit
17b99900
authored
Mar 08, 2022
by
Serena Fang
Committed by
Douglas Barbosa Alexandre
Mar 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply maintainer suggestions
parent
803ca4b8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
6 deletions
+4
-6
app/graphql/types/user_interface.rb
app/graphql/types/user_interface.rb
+1
-1
app/models/concerns/has_user_type.rb
app/models/concerns/has_user_type.rb
+2
-4
lib/api/entities/user_safe.rb
lib/api/entities/user_safe.rb
+1
-1
No files found.
app/graphql/types/user_interface.rb
View file @
17b99900
...
...
@@ -134,7 +134,7 @@ module Types
end
def
redacted_name
object
.
secure
_name
(
context
[
:current_user
])
object
.
redacted
_name
(
context
[
:current_user
])
end
end
end
app/models/concerns/has_user_type.rb
View file @
17b99900
...
...
@@ -47,12 +47,10 @@ module HasUserType
ghost?
||
(
bot?
&&
!
project_bot?
)
end
def
secure
_name
(
viewing_user
)
def
redacted
_name
(
viewing_user
)
return
self
.
name
unless
self
.
project_bot?
if
self
.
groups
.
any?
return
self
.
name
if
viewing_user
&
.
can?
(
:read_group
,
self
.
groups
.
first
)
end
return
self
.
name
if
self
.
groups
.
any?
&&
viewing_user
&
.
can?
(
:read_group
,
self
.
groups
.
first
)
return
self
.
name
if
viewing_user
&
.
can?
(
:read_project
,
self
.
projects
.
first
)
...
...
lib/api/entities/user_safe.rb
View file @
17b99900
...
...
@@ -5,7 +5,7 @@ module API
class
UserSafe
<
Grape
::
Entity
expose
:id
,
:username
expose
:name
do
|
user
|
user
.
secure
_name
(
options
[
:current_user
])
user
.
redacted
_name
(
options
[
:current_user
])
end
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