forked from mozilla/pontoon
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to send Monthly activity summary (mozilla#3474)
The changeset also factors out the base HTML email template, which is currently shared with the notifications email template. In the future, we'll use it for all HTML emails we send. In addition to the spec, a configurable Thank you note is added. The day of the month to send the summary emails on is also configurable.
- Loading branch information
Showing
7 changed files
with
584 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
pontoon/messaging/management/commands/send_monthly_activity_emails.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from django.conf import settings | ||
from django.core.management.base import BaseCommand | ||
from django.utils.timezone import now | ||
|
||
from pontoon.messaging.emails import send_monthly_activity_summary | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Send monthly activity summary emails." | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument( | ||
"--force", | ||
action="store_true", | ||
help="Force sending regardless of the current date.", | ||
) | ||
|
||
def handle(self, *args, **options): | ||
# Only send on the given day of the month or when --force is used | ||
if options["force"] or now().day == settings.MONTHLY_ACTIVITY_SUMMARY_DAY: | ||
send_monthly_activity_summary() | ||
else: | ||
self.stdout.write( | ||
f"This command can only be run on day {settings.MONTHLY_ACTIVITY_SUMMARY_DAY} of the month. Use --force to bypass." | ||
) |
Oops, something went wrong.