in src/olympia/reviewers/models.py [0:0]
def send_notifications(sender=None, instance=None, signal=None, **kw):
subscribers = instance.addon.reviewersubscription_set.all()
if not subscribers:
return
listed_perms = [
amo.permissions.ADDONS_REVIEW,
amo.permissions.ADDONS_CONTENT_REVIEW,
amo.permissions.ADDONS_RECOMMENDED_REVIEW,
amo.permissions.STATIC_THEMES_REVIEW,
amo.permissions.REVIEWER_TOOLS_VIEW,
]
unlisted_perms = [
amo.permissions.ADDONS_REVIEW_UNLISTED,
amo.permissions.REVIEWER_TOOLS_UNLISTED_VIEW,
]
for subscriber in subscribers:
user = subscriber.user
is_active_user = user and not user.deleted and user.email
is_reviewer_and_listed_submission = (
subscriber.channel == amo.CHANNEL_LISTED
and instance.channel == amo.CHANNEL_LISTED
and any(acl.action_allowed_for(user, perm) for perm in listed_perms)
)
is_unlisted_reviewer_and_unlisted_submission = (
subscriber.channel == amo.CHANNEL_UNLISTED
and instance.channel == amo.CHANNEL_UNLISTED
and any(acl.action_allowed_for(user, perm) for perm in unlisted_perms)
)
if is_active_user and (
is_reviewer_and_listed_submission
or is_unlisted_reviewer_and_unlisted_submission
):
subscriber.send_notification(instance)