include subreddit fields too

This commit is contained in:
Andre Medeiros 2022-05-01 13:24:10 -04:00
parent c2a77e7c66
commit e48460572a

View file

@ -422,9 +422,12 @@ func payloadFromMessage(acct domain.Account, msg *reddit.Thing, badgeCount int)
switch { switch {
case (msg.Kind == "t1" && msg.Type == "username_mention"): case (msg.Kind == "t1" && msg.Type == "username_mention"):
title := fmt.Sprintf(usernameMentionNotificationTitleFormat, postTitle) title := fmt.Sprintf(usernameMentionNotificationTitleFormat, postTitle)
postID := reddit.PostIDFromContext(msg.Context)
payload = payload. payload = payload.
AlertTitle(title). AlertTitle(title).
Custom("comment_id", msg.ID). Custom("comment_id", msg.ID).
Custom("post_id", postID).
Custom("subreddit", msg.Subreddit).
Custom("type", "username") Custom("type", "username")
pType, _ := reddit.SplitID(msg.ParentID) pType, _ := reddit.SplitID(msg.ParentID)
@ -444,6 +447,7 @@ func payloadFromMessage(acct domain.Account, msg *reddit.Thing, badgeCount int)
Custom("comment_id", msg.ID). Custom("comment_id", msg.ID).
Custom("post_id", postID). Custom("post_id", postID).
Custom("subject", "comment"). Custom("subject", "comment").
Custom("subreddit", msg.Subreddit).
Custom("type", "post"). Custom("type", "post").
ThreadID("comment") ThreadID("comment")
case (msg.Kind == "t1" && msg.Type == "comment_reply"): case (msg.Kind == "t1" && msg.Type == "comment_reply"):
@ -455,6 +459,7 @@ func payloadFromMessage(acct domain.Account, msg *reddit.Thing, badgeCount int)
Custom("comment_id", msg.ID). Custom("comment_id", msg.ID).
Custom("post_id", postID). Custom("post_id", postID).
Custom("subject", "comment"). Custom("subject", "comment").
Custom("subreddit", msg.Subreddit).
Custom("type", "comment"). Custom("type", "comment").
ThreadID("comment") ThreadID("comment")
case (msg.Kind == "t4"): case (msg.Kind == "t4"):