Merge branch 'main' into avm99963-monorail

Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266

GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/features/notify_helpers.py b/features/notify_helpers.py
index f22ed0e..101ba2b 100644
--- a/features/notify_helpers.py
+++ b/features/notify_helpers.py
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 """Helper functions for email notifications of issue changes."""
 from __future__ import print_function
@@ -31,7 +30,7 @@
 from framework import permissions
 from framework import template_helpers
 from framework import urls
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 from search import query2ast
 from search import searchpipeline
 from tracker import tracker_bizobj
@@ -123,7 +122,7 @@
   return notified
 
 
-class NotifyTaskBase(jsonfeed.FlaskInternalTask):
+class NotifyTaskBase(jsonfeed.InternalTask):
   """Abstract base class for notification task handler."""
 
   _EMAIL_TEMPLATE = None  # Subclasses must override this.
@@ -305,8 +304,7 @@
     subject += ': ' + issue.summary
 
   footer = _MakeNotificationFooter(reasons, addr_perm.reply_perm, hostport)
-  if isinstance(footer, six.text_type):
-    footer = footer.encode('utf-8')
+  footer = six.ensure_str(footer)
   if should_use_link_only:
     body = _TruncateBody(body_link_only) + footer
   elif addr_perm.is_member:
@@ -337,10 +335,10 @@
   template = HTML_BODY_WITH_GMAIL_ACTION_TEMPLATE
   if addr_perm.user and not addr_perm.user.email_view_widget:
     template = HTML_BODY_WITHOUT_GMAIL_ACTION_TEMPLATE
-  body_with_tags = _AddHTMLTags(body.decode('utf-8'))
+  body_with_tags = _AddHTMLTags(six.ensure_text(body))
   # Escape single quotes which are occasionally used to contain HTML
   # attributes and event handler definitions.
-  body_with_tags = body_with_tags.replace("'", ''')
+  body_with_tags = body_with_tags.replace("'", ''')
   html_body = template % {
       'url': detail_url,
       'body': body_with_tags,