-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify feature accuracy notification email (#4510)
* Change outdated feature notification emails * Address comments * Address more nits
- Loading branch information
Showing
6 changed files
with
86 additions
and
158 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
WEBSTATUS_EMAIL = '[email protected]' | ||
CBE_ESCLATION_EMAIL = '[email protected]' | ||
STAGING_EMAIL = '[email protected]' | ||
EMAIL_SUBJECT_PREFIX = 'Action requested' | ||
|
||
|
||
def get_current_milestone_info(anchor_channel: str): | ||
|
@@ -101,7 +102,10 @@ def build_email_tasks( | |
html = render_template(body_template_path, **body_data) | ||
subject = subject_format % fe.name | ||
if is_escalated: | ||
subject = f'ESCALATED: {subject}' | ||
if EMAIL_SUBJECT_PREFIX in subject: | ||
subject = subject.replace(EMAIL_SUBJECT_PREFIX, 'Escalation request') | ||
else: | ||
subject = f'ESCALATED: {subject}' | ||
recipients = choose_email_recipients(fe, is_escalated) | ||
for recipient in recipients: | ||
email_tasks.append({ | ||
|
@@ -223,7 +227,7 @@ class FeatureAccuracyHandler(AbstractReminderHandler): | |
# This grace period needs to be consistent with | ||
# ACCURACY_GRACE_PERIOD in client-src/elements/utils.ts. | ||
ACCURACY_GRACE_PERIOD = timedelta(weeks=4) | ||
SUBJECT_FORMAT = '[Action requested] Update %s' | ||
SUBJECT_FORMAT = EMAIL_SUBJECT_PREFIX + ' - Verify %s' | ||
EMAIL_TEMPLATE_PATH = 'accuracy_notice_email.html' | ||
FUTURE_MILESTONES_TO_CONSIDER = 2 | ||
MILESTONE_FIELDS = [ | ||
|
@@ -270,7 +274,7 @@ def changes_after_sending_notifications( | |
class PrepublicationHandler(AbstractReminderHandler): | ||
"""Give feature owners a final preview just before publication.""" | ||
|
||
SUBJECT_FORMAT = '[Action requested] Review %s' | ||
SUBJECT_FORMAT = EMAIL_SUBJECT_PREFIX + ' - Review %s' | ||
EMAIL_TEMPLATE_PATH = 'prepublication-notice-email.html' | ||
MILESTONE_FIELDS = [ | ||
'shipped_android_milestone', | ||
|
@@ -396,7 +400,10 @@ def build_gate_email_tasks( | |
html = render_template(self.BODY_TEMPLATE_PATH, **body_data) | ||
subject = self.SUBJECT_FORMAT % fe.name | ||
if is_escalated: | ||
subject = f'ESCALATED: {subject}' | ||
if EMAIL_SUBJECT_PREFIX in subject: | ||
subject = subject.replace(EMAIL_SUBJECT_PREFIX, 'Escalation request') | ||
else: | ||
subject = f'ESCALATED: {subject}' | ||
recipients = self.choose_reviewers(gate, is_escalated) | ||
for recipient in recipients: | ||
email_tasks.append({ | ||
|
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 |
---|---|---|
|
@@ -145,15 +145,15 @@ def test_build_email_tasks_feature_accuracy(self): | |
handler = reminders.FeatureAccuracyHandler() | ||
actual = reminders.build_email_tasks( | ||
[(self.feature_template, 100)], | ||
'[Action requested] Update %s', | ||
'Action requested - Verify %s', | ||
handler.EMAIL_TEMPLATE_PATH, | ||
self.current_milestone_info, | ||
handler.should_escalate_notification) | ||
|
||
self.assertEqual(1, len(actual)) | ||
task = actual[0] | ||
self.assertEqual('[email protected]', task['to']) | ||
self.assertEqual('[Action requested] Update feature one', task['subject']) | ||
self.assertEqual('Action requested - Verify feature one', task['subject']) | ||
self.assertEqual(None, task['reply_to']) | ||
# TESTDATA.make_golden(task['html'], 'test_build_email_tasks_feature_accuracy.html') | ||
self.assertMultiLineEqual( | ||
|
@@ -164,15 +164,15 @@ def test_build_email_tasks_feature_accuracy__enterprise(self): | |
handler = reminders.FeatureAccuracyHandler() | ||
actual = reminders.build_email_tasks( | ||
[(self.feature_template, 110)], | ||
'[Action requested] Update %s', | ||
'Action requested - Verify %s', | ||
handler.EMAIL_TEMPLATE_PATH, | ||
self.current_milestone_info, | ||
handler.should_escalate_notification) | ||
|
||
self.assertEqual(1, len(actual)) | ||
task = actual[0] | ||
self.assertEqual('[email protected]', task['to']) | ||
self.assertEqual('[Action requested] Update feature one', task['subject']) | ||
self.assertEqual('Action requested - Verify feature one', task['subject']) | ||
self.assertEqual(None, task['reply_to']) | ||
# TESTDATA.make_golden(task['html'], 'test_build_email_tasks_feature_accuracy_enterprise.html') | ||
self.assertMultiLineEqual( | ||
|
@@ -187,15 +187,15 @@ def test_build_email_tasks_feature_accuracy__escalated(self): | |
handler = reminders.FeatureAccuracyHandler() | ||
actual = reminders.build_email_tasks( | ||
[(self.feature_template, 100)], | ||
'[Action requested] Update %s', | ||
'Action requested - Verify %s', | ||
handler.EMAIL_TEMPLATE_PATH, | ||
self.current_milestone_info, | ||
handler.should_escalate_notification) | ||
|
||
self.assertEqual(5, len(actual)) | ||
task = actual[0] | ||
self.assertEqual( | ||
'ESCALATED: [Action requested] Update feature one', task['subject']) | ||
'Escalation request - Verify feature one', task['subject']) | ||
self.assertEqual(None, task['reply_to']) | ||
# TESTDATA.make_golden(task['html'], 'test_build_email_tasks_escalated_feature_accuracy.html') | ||
self.assertMultiLineEqual( | ||
|
@@ -205,13 +205,13 @@ def test_build_email_tasks_prepublication(self): | |
with test_app.app_context(): | ||
handler = reminders.PrepublicationHandler() | ||
actual = reminders.build_email_tasks( | ||
[(self.feature_template, 100)], '[Action requested] Update %s', | ||
[(self.feature_template, 100)], 'Action requested - Verify %s', | ||
handler.EMAIL_TEMPLATE_PATH, | ||
self.current_milestone_info, handler.should_escalate_notification) | ||
self.assertEqual(1, len(actual)) | ||
task = actual[0] | ||
self.assertEqual('[email protected]', task['to']) | ||
self.assertEqual('[Action requested] Update feature one', task['subject']) | ||
self.assertEqual('Action requested - Verify feature one', task['subject']) | ||
self.assertEqual(None, task['reply_to']) | ||
# TESTDATA.make_golden(task['html'], 'test_build_email_tasks_prepublication.html') | ||
self.assertMultiLineEqual( | ||
|
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
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
Oops, something went wrong.