Generalize post reply notifications.
CI / test (pull_request) Successful in 6m23s

Notify direct parent authors throughout threaded conversations while skipping self-replies, edits, and recipients without email.
This commit is contained in:
2026-08-27 08:57:16 -07:00
parent 7412069ca6
commit 3dde9f79f4
7 changed files with 279 additions and 59 deletions
+10 -1
View File
@@ -19,6 +19,7 @@ import (
"plumber"
"plumber/internal/blob"
"plumber/internal/mail"
"plumber/internal/pacific"
"plumber/internal/store"
)
@@ -483,7 +484,8 @@ func TestProfileAdminAnsweredListAndAvatarUpload(t *testing.T) {
}
func TestMutationsVoteAnswerHideAndCSRF(t *testing.T) {
srv, mem := newTestServer(t, Config{})
recording := &mail.Recording{}
srv, mem := newTestServer(t, Config{Mail: recording})
h := srv.Handler()
adminName := uniq("admin")
userName := uniq("user")
@@ -611,6 +613,13 @@ func TestMutationsVoteAnswerHideAndCSRF(t *testing.T) {
if got := rec.Header().Get("HX-Redirect"); got != "/questions/"+q.ID+"#post-"+adminReply.ID {
t.Fatalf("admin answer redirect = %q", got)
}
msgs := waitForMail(t, recording, 1)
if msg := msgs[0]; msg.ToEmail != user.Email ||
msg.RootID != q.ID ||
msg.ReplyID != adminReply.ID ||
msg.ReplyBody != adminReply.Body {
t.Fatalf("compatibility reply notification = %+v", msg)
}
rec = httptest.NewRecorder()
req = httptest.NewRequest(http.MethodGet, "/questions/"+q.ID, nil)