Always let through notifications from staff (#9152)

* Always let through notifications from staff

Follow-up to #8993

* Let messages from staff through, but no other notifications
This commit is contained in:
Eugen Rochko 2018-10-30 15:02:55 +01:00 committed by GitHub
parent a03d506626
commit 47b8d195e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -51,8 +51,12 @@ class NotifyService < BaseService
@recipient.user.settings.interactions['must_be_following'] && !following_sender? @recipient.user.settings.interactions['must_be_following'] && !following_sender?
end end
def message?
@notification.type == :mention
end
def direct_message? def direct_message?
@notification.type == :mention && @notification.target_status.direct_visibility? message? && @notification.target_status.direct_visibility?
end end
def response_to_recipient? def response_to_recipient?
@ -66,7 +70,6 @@ class NotifyService < BaseService
def optional_non_following_and_direct? def optional_non_following_and_direct?
direct_message? && direct_message? &&
@recipient.user.settings.interactions['must_be_following_dm'] && @recipient.user.settings.interactions['must_be_following_dm'] &&
!from_staff? &&
!following_sender? && !following_sender? &&
!response_to_recipient? !response_to_recipient?
end end
@ -86,6 +89,9 @@ class NotifyService < BaseService
def blocked? def blocked?
blocked = @recipient.suspended? # Skip if the recipient account is suspended anyway blocked = @recipient.suspended? # Skip if the recipient account is suspended anyway
blocked ||= from_self? # Skip for interactions with self blocked ||= from_self? # Skip for interactions with self
return blocked if message? && from_staff?
blocked ||= domain_blocking? # Skip for domain blocked accounts blocked ||= domain_blocking? # Skip for domain blocked accounts
blocked ||= @recipient.blocking?(@notification.from_account) # Skip for blocked accounts blocked ||= @recipient.blocking?(@notification.from_account) # Skip for blocked accounts
blocked ||= @recipient.muting_notifications?(@notification.from_account) blocked ||= @recipient.muting_notifications?(@notification.from_account)