Add support for topic in Zulip notifications and truncate long topics

Subjects over 60 characters long, such as the test notification, are rejected by shoutrrr. This truncates the subject to the max length.

Users may want all Scrutiny notifications to be sent to a particular topic rather than whatever Scrutiny happens to decide.
This commit is contained in:
Merlin
2026-02-28 13:27:16 -05:00
committed by GitHub
parent 9d1ce790d0
commit 6a278bc2cf
+11
View File
@@ -424,6 +424,17 @@ func (n *Notify) GenShoutrrrNotificationParams(shoutrrrUrl string) (string, *sho
case "telegram":
(*params)["title"] = subject
case "zulip":
query := serviceURL.Query()
urlTopic := query["topic"]
delete(query, "topic")
if len(urlTopic) > 0 && urlTopic[len(urlTopic)-1] != "" {
subject = urlTopic[len(urlTopic)-1]
}
subjectRunes := []rune(subject)
if len(subjectRunes) > 60 {
n.Logger.Warningf("Zulip notification subject too long (%d characters), truncating to 60 characters", len(subjectRunes))
subject = string(subjectRunes[:60])
}
(*params)["topic"] = subject
}