From 472c9ed3de3e252bc51cfa9fe2ee5774e339b43f Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Mon, 25 Nov 2019 10:06:42 +0100 Subject: [PATCH] Set subject for notification about new comment, subject should not be empty (#589) --- isso/ext/notifications.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/isso/ext/notifications.py b/isso/ext/notifications.py index 9fccd25..0743b6b 100644 --- a/isso/ext/notifications.py +++ b/isso/ext/notifications.py @@ -149,7 +149,10 @@ class SMTP(object): def notify_new(self, thread, comment): if self.admin_notify: body = self.format(thread, comment, None, admin=True) - self.sendmail(thread["title"], body, thread, comment) + subject = "New comment posted" + if thread['title']: + subject = "%s on %s" % (subject, thread["title"]) + self.sendmail(subject, body, thread, comment) if comment["mode"] == 1: self.notify_users(thread, comment) @@ -175,6 +178,9 @@ class SMTP(object): def sendmail(self, subject, body, thread, comment, to=None): to = to or self.conf.get("to") + if not subject: + # Fallback, just in case as an empty subject does not work + subject = 'isso notification' if uwsgi: uwsgi.spool({b"subject": subject.encode("utf-8"), b"body": body.encode("utf-8"),