fix: revert Set reply-to header for notifications to ML

The change broke the initial emails to the ML. Not sure why but reverting this now and might look at later

This reverts commit 783422369e.

fixes: #502
This commit is contained in:
Leonidas Spyropoulos 2024-06-09 23:08:35 +01:00
parent ef0619dc2f
commit 85af7d6f04
No known key found for this signature in database
GPG key ID: 244740D17C7FD0EC
2 changed files with 1 additions and 19 deletions

View file

@ -59,13 +59,10 @@ class Notification:
body += "\n" + "[%d] %s" % (i + 1, ref) body += "\n" + "[%d] %s" % (i + 1, ref)
return body.rstrip() return body.rstrip()
def get_reply_to(self):
return aurweb.config.get("notifications", "reply-to")
def _send(self) -> None: def _send(self) -> None:
sendmail = aurweb.config.get("notifications", "sendmail") sendmail = aurweb.config.get("notifications", "sendmail")
sender = aurweb.config.get("notifications", "sender") sender = aurweb.config.get("notifications", "sender")
reply_to = self.get_reply_to() reply_to = aurweb.config.get("notifications", "reply-to")
reason = self.__class__.__name__ reason = self.__class__.__name__
if reason.endswith("Notification"): if reason.endswith("Notification"):
reason = reason[: -len("Notification")] reason = reason[: -len("Notification")]
@ -566,7 +563,6 @@ class RequestOpenNotification(Notification):
) )
self._to = aurweb.config.get("options", "aur_request_ml") self._to = aurweb.config.get("options", "aur_request_ml")
self._reply_to = self._to
query = ( query = (
db.query(PackageRequest) db.query(PackageRequest)
@ -603,9 +599,6 @@ class RequestOpenNotification(Notification):
def get_recipients(self): def get_recipients(self):
return [(self._to, "en")] return [(self._to, "en")]
def get_reply_to(self):
return self._reply_to
def get_cc(self): def get_cc(self):
return self._cc return self._cc
@ -661,7 +654,6 @@ class RequestCloseNotification(Notification):
self._user = user.Username if user else None self._user = user.Username if user else None
self._to = aurweb.config.get("options", "aur_request_ml") self._to = aurweb.config.get("options", "aur_request_ml")
self._reply_to = self._to
query = ( query = (
db.query(PackageRequest) db.query(PackageRequest)
@ -708,9 +700,6 @@ class RequestCloseNotification(Notification):
def get_recipients(self): def get_recipients(self):
return [(self._to, "en")] return [(self._to, "en")]
def get_reply_to(self):
return self._reply_to
def get_cc(self): def get_cc(self):
return self._cc return self._cc

View file

@ -13,7 +13,6 @@ from aurweb.testing.smtp import FakeSMTP, FakeSMTP_SSL
aur_location = config.get("options", "aur_location") aur_location = config.get("options", "aur_location")
aur_request_ml = config.get("options", "aur_request_ml") aur_request_ml = config.get("options", "aur_request_ml")
aur_reply_to = config.get("notifications", "reply-to")
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@ -412,7 +411,6 @@ def test_open_close_request(
email = Email(1).parse() email = Email(1).parse()
assert email.headers.get("To") == aur_request_ml assert email.headers.get("To") == aur_request_ml
assert email.headers.get("Reply-to") == aur_request_ml
assert email.headers.get("Cc") == ", ".join([user.Email, user2.Email]) assert email.headers.get("Cc") == ", ".join([user.Email, user2.Email])
expected = f"[PRQ#{pkgreq.ID}] Orphan Request for {pkgbase.Name}" expected = f"[PRQ#{pkgreq.ID}] Orphan Request for {pkgbase.Name}"
assert email.headers.get("Subject") == expected assert email.headers.get("Subject") == expected
@ -434,7 +432,6 @@ This is a request test comment.
email = Email(2).parse() email = Email(2).parse()
assert email.headers.get("To") == aur_request_ml assert email.headers.get("To") == aur_request_ml
assert email.headers.get("Reply-to") == aur_request_ml
assert email.headers.get("Cc") == ", ".join([user.Email, user2.Email]) assert email.headers.get("Cc") == ", ".join([user.Email, user2.Email])
expected = f"[PRQ#{pkgreq.ID}] Orphan Request for {pkgbase.Name} Rejected" expected = f"[PRQ#{pkgreq.ID}] Orphan Request for {pkgbase.Name} Rejected"
assert email.headers.get("Subject") == expected assert email.headers.get("Subject") == expected
@ -453,7 +450,6 @@ Request #{pkgreq.ID} has been rejected by {user2.Username} [1].
email = Email(3).parse() email = Email(3).parse()
assert email.headers.get("To") == aur_request_ml assert email.headers.get("To") == aur_request_ml
assert email.headers.get("Reply-to") == aur_request_ml
assert email.headers.get("Cc") == ", ".join([user.Email, user2.Email]) assert email.headers.get("Cc") == ", ".join([user.Email, user2.Email])
expected = f"[PRQ#{pkgreq.ID}] Orphan Request for " f"{pkgbase.Name} Accepted" expected = f"[PRQ#{pkgreq.ID}] Orphan Request for " f"{pkgbase.Name} Accepted"
assert email.headers.get("Subject") == expected assert email.headers.get("Subject") == expected
@ -480,7 +476,6 @@ def test_close_request_comaintainer_cc(
email = Email(1).parse() email = Email(1).parse()
assert email.headers.get("To") == aur_request_ml assert email.headers.get("To") == aur_request_ml
assert email.headers.get("Reply-to") == aur_request_ml
assert email.headers.get("Cc") == ", ".join([user.Email, user2.Email]) assert email.headers.get("Cc") == ", ".join([user.Email, user2.Email])
@ -535,7 +530,6 @@ def test_close_request_closure_comment(
email = Email(1).parse() email = Email(1).parse()
assert email.headers.get("To") == aur_request_ml assert email.headers.get("To") == aur_request_ml
assert email.headers.get("Reply-to") == aur_request_ml
assert email.headers.get("Cc") == ", ".join([user.Email, user2.Email]) assert email.headers.get("Cc") == ", ".join([user.Email, user2.Email])
expected = f"[PRQ#{pkgreq.ID}] Orphan Request for {pkgbase.Name} Accepted" expected = f"[PRQ#{pkgreq.ID}] Orphan Request for {pkgbase.Name} Accepted"
assert email.headers.get("Subject") == expected assert email.headers.get("Subject") == expected
@ -727,7 +721,6 @@ def test_notification_defaults():
assert notif.get_refs() == tuple() assert notif.get_refs() == tuple()
assert notif.get_headers() == dict() assert notif.get_headers() == dict()
assert notif.get_cc() == list() assert notif.get_cc() == list()
assert notif.get_reply_to() == aur_reply_to
def test_notification_oserror(user: User, caplog: pytest.LogCaptureFixture): def test_notification_oserror(user: User, caplog: pytest.LogCaptureFixture):