Skip to content
Snippets Groups Projects
Commit 74496838 authored by Matt Jankowski's avatar Matt Jankowski Committed by Claire
Browse files

Add `UserRole#bypass_block?` method for notification check (#32974)

parent ca390694
No related branches found
No related tags found
No related merge requests found
......@@ -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?
......
......@@ -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?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment