Skip to content

Commit 5b5bde8

Browse files
committed
switch is_superuser to is_staff for email & notification sending
1 parent b500c17 commit 5b5bde8

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

‎pontoon/messaging/emails.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ def send_monthly_health_report_emails(report):
659659
log.info("Start sending report emails.")
660660

661661
users = User.objects.filter(
662-
is_active=True, is_superuser=True, profile__monthly_health_report=True
662+
is_active=True, is_staff=True, profile__monthly_health_report=True
663663
)
664664

665665
subject = f"Monthly locale health report for {report['month']} {report['year']}"

‎pontoon/messaging/management/commands/send_monthly_health_report_notifications_and_emails.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def handle(self, *args, **options):
4141

4242
send_monthly_health_report_emails(report)
4343

44-
admins = User.objects.filter(is_staff=True)
44+
admins = User.objects.filter(is_active=True, is_staff=True)
4545

4646
description = render_to_string(
4747
"messaging/notifications/monthly_health_report.html", report

‎pontoon/messaging/tests/test_emails.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,11 @@ def test_send_inactive_translator_emails(user_a, locale_a):
219219

220220
@pytest.mark.django_db
221221
def test_send_monthly_health_report_emails(locale_a):
222-
subscribed_admin = UserFactory.create(
223-
username="admin_subscribed", is_superuser=True
224-
)
222+
subscribed_admin = UserFactory.create(username="admin_subscribed", is_staff=True)
225223
subscribed_admin.profile.monthly_health_report = True
226224
subscribed_admin.profile.save()
227225

228-
UserFactory.create(username="admin_unsubscribed", is_superuser=True)
226+
UserFactory.create(username="admin_unsubscribed", is_staff=True)
229227

230228
subscribed_contributor = UserFactory.create(username="contributor")
231229
subscribed_contributor.profile.monthly_health_report = True

0 commit comments

Comments
 (0)