Skip to content

Commit

Permalink
Simplify feature accuracy notification email (#4510)
Browse files Browse the repository at this point in the history
* Change outdated feature notification emails

* Address comments

* Address more nits
  • Loading branch information
KyleJu authored Nov 5, 2024
1 parent f0a2906 commit 7debf8a
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 158 deletions.
15 changes: 11 additions & 4 deletions internals/reminders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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({
Expand Down
16 changes: 8 additions & 8 deletions internals/reminders_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,20 @@
<section id="context" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">
<table>
<tr>
<td rowspan=2>

<div style="border: 4px solid #d32f2f; border-radius: 50%; width: 32px; height: 32px; margin-right: 8px;">
</div>

</td>
<td><b>Your update is needed</b> on feature entry:</td>
<td>Your feature is slated to launch soon for M100. <b>Please verify the accuracy of </b><a
href="http://127.0.0.1:7777/feature/123">feature one</a>:</td>
</tr>
<tr>
<td><a style="font-size: 140%;"
href="http://127.0.0.1:7777/feature/123"
>feature one</a>
<td>
<div style="margin: 16px;">
<a href="http://127.0.0.1:7777/guide/verify_accuracy/123" style="text-decoration: none; font-weight: bold; color: white; background: #01579b; border-radius: 8px; padding: 8px 16px; ">Verify feature accuracy</a>
</div>
</td>
</tr>
</table>
</section>


<section id="why-triggered" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">

<p>
In order to ensure feature data accuracy, this notification has been
escalated to extended contributors of this feature and to the WebStatus team.
</p>


<p>
You are receiving this notification because you are listed as
a contributor
of the ChromeStatus feature entry.
</p>
</section>


<section id="details" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">
<p>Your feature is slated to launch soon for m100:</p>
<p>


Expand Down Expand Up @@ -78,23 +56,24 @@
<p>
Your feature entry is an important resource for
cross functional teams that help drive adoption of new features and
enterprise IT admins who might be affected by web platform changes.
enterprise IT admins who might be affected by web platform changes. We
need to have a record of whether your plans are changing or staying the same.
</p>
</section>

<section id="why-triggered" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">

<p>
We need to know whether your plans are changing or staying
the same. <strong>Please click the link below to update and confirm key
fields of your feature entry.</strong>
In order to ensure feature data accuracy, this notification has been
escalated to extended contributors of this feature and to the Chromestatus team.
</p>
</section>


<section id="next-steps" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">
<div><b>Your next steps:</b></div>


<div style="margin: 16px;">
<a href="http://127.0.0.1:7777/guide/verify_accuracy/123" style="text-decoration: none; font-weight: bold; color: white; background: #01579b; border-radius: 8px; padding: 8px 16px; "
>Verify feature accuracy</a></div>
<p>
You are receiving this notification because you are listed as
a contributor
of the ChromeStatus feature entry.
</p>
</section>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,20 @@
<section id="context" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">
<table>
<tr>
<td rowspan=2>

<div style="border: 4px solid #d32f2f; border-radius: 50%; width: 32px; height: 32px; margin-right: 8px;">
</div>

</td>
<td><b>Your update is needed</b> on feature entry:</td>
<td>Your feature is slated to launch soon for M100. <b>Please verify the accuracy of </b><a
href="http://127.0.0.1:7777/feature/123">feature one</a>:</td>
</tr>
<tr>
<td><a style="font-size: 140%;"
href="http://127.0.0.1:7777/feature/123"
>feature one</a>
<td>
<div style="margin: 16px;">
<a href="http://127.0.0.1:7777/guide/verify_accuracy/123" style="text-decoration: none; font-weight: bold; color: white; background: #01579b; border-radius: 8px; padding: 8px 16px; ">Verify feature accuracy</a>
</div>
</td>
</tr>
</table>
</section>


<section id="why-triggered" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">


<p>
You are receiving this notification because you are listed as
an owner
of the ChromeStatus feature entry.
</p>
</section>


<section id="details" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">
<p>Your feature is slated to launch soon for m100:</p>
<p>


Expand Down Expand Up @@ -73,23 +56,19 @@
<p>
Your feature entry is an important resource for
cross functional teams that help drive adoption of new features and
enterprise IT admins who might be affected by web platform changes.
</p>

<p>
We need to know whether your plans are changing or staying
the same. <strong>Please click the link below to update and confirm key
fields of your feature entry.</strong>
enterprise IT admins who might be affected by web platform changes. We
need to have a record of whether your plans are changing or staying the same.
</p>
</section>

<section id="why-triggered" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">


<section id="next-steps" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">
<div><b>Your next steps:</b></div>

<div style="margin: 16px;">
<a href="http://127.0.0.1:7777/guide/verify_accuracy/123" style="text-decoration: none; font-weight: bold; color: white; background: #01579b; border-radius: 8px; padding: 8px 16px; "
>Verify feature accuracy</a></div>
<p>
You are receiving this notification because you are listed as
an owner
of the ChromeStatus feature entry.
</p>
</section>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,20 @@
<section id="context" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">
<table>
<tr>
<td rowspan=2>

<div style="border: 4px solid #d32f2f; border-radius: 50%; width: 32px; height: 32px; margin-right: 8px;">
</div>

</td>
<td><b>Your update is needed</b> on feature entry:</td>
<td>Your feature is slated to launch soon for M110. <b>Please verify the accuracy of </b><a
href="http://127.0.0.1:7777/feature/123">feature one</a>:</td>
</tr>
<tr>
<td><a style="font-size: 140%;"
href="http://127.0.0.1:7777/feature/123"
>feature one</a>
<td>
<div style="margin: 16px;">
<a href="http://127.0.0.1:7777/guide/verify_accuracy/123" style="text-decoration: none; font-weight: bold; color: white; background: #01579b; border-radius: 8px; padding: 8px 16px; ">Verify feature accuracy</a>
</div>
</td>
</tr>
</table>
</section>


<section id="why-triggered" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">


<p>
You are receiving this notification because you are listed as
an owner
of the ChromeStatus feature entry.
</p>
</section>


<section id="details" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">
<p>Your feature is slated to launch soon for m110:</p>
<p>


Expand Down Expand Up @@ -73,23 +56,19 @@
<p>
Your feature entry is an important resource for
cross functional teams that help drive adoption of new features and
enterprise IT admins who might be affected by web platform changes.
</p>

<p>
We need to know whether your plans are changing or staying
the same. <strong>Please click the link below to update and confirm key
fields of your feature entry.</strong>
enterprise IT admins who might be affected by web platform changes. We
need to have a record of whether your plans are changing or staying the same.
</p>
</section>

<section id="why-triggered" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">


<section id="next-steps" style="margin: 16px; padding: 16px; background: white; border: 2px solid #ccc; border-radius:8px;">
<div><b>Your next steps:</b></div>

<div style="margin: 16px;">
<a href="http://127.0.0.1:7777/guide/verify_accuracy/123" style="text-decoration: none; font-weight: bold; color: white; background: #01579b; border-radius: 8px; padding: 8px 16px; "
>Verify feature accuracy</a></div>
<p>
You are receiving this notification because you are listed as
an owner
of the ChromeStatus feature entry.
</p>
</section>

</div>
Expand Down
Loading

0 comments on commit 7debf8a

Please sign in to comment.