🐛 Fix post visibility didn't apply when notifying close #3

This commit is contained in:
2024-12-15 23:50:54 +08:00
parent 76e7dd7a07
commit 3213a3969e
3 changed files with 85 additions and 6 deletions

View File

@@ -429,16 +429,17 @@ func NewPost(user models.Publisher, item models.Post) (models.Post, error) {
var title *string
title, _ = item.Body["title"].(*string)
go func() {
if err := NotifyUserSubscription(user, content, title); err != nil {
item.Publisher = user
if err := NotifyUserSubscription(user, item, content, title); err != nil {
log.Error().Err(err).Msg("An error occurred when notifying subscriptions user by user...")
}
for _, tag := range item.Tags {
if err := NotifyTagSubscription(tag, user, content, title); err != nil {
if err := NotifyTagSubscription(tag, user, item, content, title); err != nil {
log.Error().Err(err).Msg("An error occurred when notifying subscriptions user by tag...")
}
}
for _, category := range item.Categories {
if err := NotifyCategorySubscription(category, user, content, title); err != nil {
if err := NotifyCategorySubscription(category, user, item, content, title); err != nil {
log.Error().Err(err).Msg("An error occurred when notifying subscriptions user by category...")
}
}