✨ Notify poster with avatar
This commit is contained in:
		@@ -28,7 +28,7 @@ func ModifyPosterVoteCount(user models.Publisher, isUpvote bool, delta int) erro
 | 
				
			|||||||
	return database.C.Save(&user).Error
 | 
						return database.C.Save(&user).Error
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func NotifyPosterAccount(pub models.Publisher, post models.Post, title, body string, subtitle ...string) error {
 | 
					func NotifyPosterAccount(pub models.Publisher, post models.Post, title, body, topic string, subtitle ...string) error {
 | 
				
			||||||
	if pub.AccountID == nil {
 | 
						if pub.AccountID == nil {
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -38,13 +38,14 @@ func NotifyPosterAccount(pub models.Publisher, post models.Post, title, body str
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err := authkit.NotifyUser(gap.Nx, uint64(*pub.AccountID), pushkit.Notification{
 | 
						err := authkit.NotifyUser(gap.Nx, uint64(*pub.AccountID), pushkit.Notification{
 | 
				
			||||||
		Topic:    "interactive.feedback",
 | 
							Topic:    topic,
 | 
				
			||||||
		Title:    title,
 | 
							Title:    title,
 | 
				
			||||||
		Subtitle: subtitle[0],
 | 
							Subtitle: subtitle[0],
 | 
				
			||||||
		Body:     body,
 | 
							Body:     body,
 | 
				
			||||||
		Priority: 4,
 | 
							Priority: 4,
 | 
				
			||||||
		Metadata: map[string]any{
 | 
							Metadata: map[string]any{
 | 
				
			||||||
			"related_post": TruncatePostContent(post),
 | 
								"related_post": TruncatePostContent(post),
 | 
				
			||||||
 | 
								"avatar":       pub.Avatar,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -348,6 +348,7 @@ func NewPost(user models.Publisher, item models.Post) (models.Post, error) {
 | 
				
			|||||||
					op,
 | 
										op,
 | 
				
			||||||
					"Post got replied",
 | 
										"Post got replied",
 | 
				
			||||||
					fmt.Sprintf("%s (%s) replied your post (#%d).", user.Nick, user.Name, op.ID),
 | 
										fmt.Sprintf("%s (%s) replied your post (#%d).", user.Nick, user.Name, op.ID),
 | 
				
			||||||
 | 
										"interactive.reply",
 | 
				
			||||||
					fmt.Sprintf("%s replied you", user.Nick),
 | 
										fmt.Sprintf("%s replied you", user.Nick),
 | 
				
			||||||
				)
 | 
									)
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
@@ -431,6 +432,7 @@ func ReactPost(user authm.Account, reaction models.Reaction) (bool, models.React
 | 
				
			|||||||
					op,
 | 
										op,
 | 
				
			||||||
					"Post got reacted",
 | 
										"Post got reacted",
 | 
				
			||||||
					fmt.Sprintf("%s (%s) reacted your post a %s.", user.Nick, user.Name, reaction.Symbol),
 | 
										fmt.Sprintf("%s (%s) reacted your post a %s.", user.Nick, user.Name, reaction.Symbol),
 | 
				
			||||||
 | 
										"interactive.feedback",
 | 
				
			||||||
					fmt.Sprintf("%s reacted you", user.Nick),
 | 
										fmt.Sprintf("%s reacted you", user.Nick),
 | 
				
			||||||
				)
 | 
									)
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user