Просмотр исходного кода

Don't try and send a notification if there is no message to send.

¯\_(ツ)_/¯
Ted Kaemming 9 лет назад
Родитель
Сommit
bfb1773594
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      src/sentry/plugins/sentry_mail/models.py

+ 4 - 2
src/sentry/plugins/sentry_mail/models.py

@@ -72,7 +72,9 @@ class MailPlugin(NotificationPlugin):
         return msg
 
     def _send_mail(self, *args, **kwargs):
-        return self._build_message(*args, **kwargs).send()
+        message = self._build_message(*args, **kwargs)
+        if message is not None:
+            return message.send()
 
     def send_test_mail(self, project=None):
         self._send_mail(
@@ -230,7 +232,7 @@ class MailPlugin(NotificationPlugin):
             context=context,
         )
 
-        if features.has('projects:digests:deliver', project):
+        if message is not None and features.has('projects:digests:deliver', project):
             message.send()
 
     def notify_about_activity(self, activity):