Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Mastodon
Commits
74496838
Commit
74496838
authored
3 months ago
by
Matt Jankowski
Committed by
Claire
2 weeks ago
Browse files
Options
Downloads
Patches
Plain Diff
Add `UserRole#bypass_block?` method for notification check (#32974)
parent
ca390694
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/user_role.rb
+4
-0
4 additions, 0 deletions
app/models/user_role.rb
app/services/notify_service.rb
+1
-1
1 addition, 1 deletion
app/services/notify_service.rb
with
5 additions
and
1 deletion
app/models/user_role.rb
+
4
−
0
View file @
74496838
...
...
@@ -142,6 +142,10 @@ class UserRole < ApplicationRecord
other_role
.
nil?
||
position
>
other_role
.
position
end
def
bypass_block?
(
role
)
overrides?
(
role
)
&&
highlighted?
&&
can?
(
*
Flags
::
CATEGORIES
[
:moderation
])
end
def
computed_permissions
# If called on the everyone role, no further computation needed
return
permissions
if
everyone?
...
...
This diff is collapsed.
Click to expand it.
app/services/notify_service.rb
+
1
−
1
View file @
74496838
...
...
@@ -132,7 +132,7 @@ class NotifyService < BaseService
end
def
from_staff?
@sender
.
local?
&&
@sender
.
user
.
present?
&&
@sender
.
user_role
&
.
overrides
?
(
@recipient
.
user_role
)
&&
@sender
.
user_role
&
.
highlighted?
&&
@sender
.
user_role
&
.
can?
(
*
UserRole
::
Flags
::
CATEGORIES
[
:moderation
])
@sender
.
local?
&&
@sender
.
user
.
present?
&&
@sender
.
user_role
&
.
bypass_block
?
(
@recipient
.
user_role
)
end
def
from_self?
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment