mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 11:47:42 +00:00
change remaining notification titles
This commit is contained in:
parent
8502a67352
commit
a429ee9987
1 changed files with 9 additions and 4 deletions
|
@ -25,6 +25,11 @@ const (
|
|||
backoff = 5 // How long we wait in between checking for notifications, in seconds
|
||||
pollDuration = 5 * time.Millisecond
|
||||
rate = 0.1
|
||||
|
||||
postReplyNotificationTitleFormat = "%s to %s"
|
||||
commentReplyNotificationTitleFormat = "%s in %s"
|
||||
privateMessageNotificationTitleFormat = "Message from %s"
|
||||
usernameMentionNotificationTitleFormat = "Mention in \u201c%s\u201d"
|
||||
)
|
||||
|
||||
type notificationsWorker struct {
|
||||
|
@ -416,7 +421,7 @@ func payloadFromMessage(acct domain.Account, msg *reddit.Thing, badgeCount int)
|
|||
|
||||
switch {
|
||||
case (msg.Kind == "t1" && msg.Type == "username_mention"):
|
||||
title := fmt.Sprintf(`Mention in “%s”`, postTitle)
|
||||
title := fmt.Sprintf(usernameMentionNotificationTitleFormat, postTitle)
|
||||
payload = payload.AlertTitle(title).Custom("type", "username")
|
||||
|
||||
pType, _ := reddit.SplitID(msg.ParentID)
|
||||
|
@ -428,7 +433,7 @@ func payloadFromMessage(acct domain.Account, msg *reddit.Thing, badgeCount int)
|
|||
|
||||
payload = payload.Custom("subject", "comment").ThreadID("comment")
|
||||
case (msg.Kind == "t1" && msg.Type == "post_reply"):
|
||||
title := fmt.Sprintf(`%s to “%s”`, msg.Author, postTitle)
|
||||
title := fmt.Sprintf(postReplyNotificationTitleFormat, msg.Author, postTitle)
|
||||
payload = payload.
|
||||
AlertTitle(title).
|
||||
Category("inbox-post-reply").
|
||||
|
@ -437,7 +442,7 @@ func payloadFromMessage(acct domain.Account, msg *reddit.Thing, badgeCount int)
|
|||
Custom("type", "post").
|
||||
ThreadID("comment")
|
||||
case (msg.Kind == "t1" && msg.Type == "comment_reply"):
|
||||
title := fmt.Sprintf(`%s in “%s”`, msg.Author, postTitle)
|
||||
title := fmt.Sprintf(commentReplyNotificationTitleFormat, msg.Author, postTitle)
|
||||
postID := reddit.PostIDFromContext(msg.Context)
|
||||
payload = payload.
|
||||
AlertTitle(title).
|
||||
|
@ -448,7 +453,7 @@ func payloadFromMessage(acct domain.Account, msg *reddit.Thing, badgeCount int)
|
|||
Custom("type", "comment").
|
||||
ThreadID("comment")
|
||||
case (msg.Kind == "t4"):
|
||||
title := fmt.Sprintf(`Message from %s`, msg.Author)
|
||||
title := fmt.Sprintf(privateMessageNotificationTitleFormat, msg.Author)
|
||||
payload = payload.
|
||||
AlertTitle(title).
|
||||
AlertSubtitle(postTitle).
|
||||
|
|
Loading…
Reference in a new issue