mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-25 15:09:29 +00:00
Add UserRole#enables_delivery?
method for notification check
This commit is contained in:
parent
37f00fb018
commit
caf71ae4bc
|
@ -142,6 +142,10 @@ class UserRole < ApplicationRecord
|
||||||
other_role.nil? || position > other_role.position
|
other_role.nil? || position > other_role.position
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def enables_delivery?(role)
|
||||||
|
overrides?(role) && highlighted? && can?(*Flags::CATEGORIES[:moderation])
|
||||||
|
end
|
||||||
|
|
||||||
def computed_permissions
|
def computed_permissions
|
||||||
# If called on the everyone role, no further computation needed
|
# If called on the everyone role, no further computation needed
|
||||||
return permissions if everyone?
|
return permissions if everyone?
|
||||||
|
|
|
@ -134,7 +134,7 @@ class NotifyService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def from_staff?
|
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&.enables_delivery?(@recipient.user_role)
|
||||||
end
|
end
|
||||||
|
|
||||||
def from_self?
|
def from_self?
|
||||||
|
|
Loading…
Reference in a new issue