From 4e2147b679cc2f939dc2dfb5a3be01a5cdd96e1d Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 12 Feb 2024 17:54:36 +0800 Subject: [PATCH] :sparkles: Bug fixes --- pkg/services/posts.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/services/posts.go b/pkg/services/posts.go index 1591b9e..25a66e0 100644 --- a/pkg/services/posts.go +++ b/pkg/services/posts.go @@ -195,7 +195,7 @@ func NewPost( BaseModel: models.BaseModel{ID: *post.ReplyID}, }).Preload("Author").First(&op).Error; err == nil { if op.Author.ID != user.ID { - postUrl := fmt.Sprintf("https://%s/posts/%d", viper.GetString("domain"), post.ID) + postUrl := fmt.Sprintf("https://%s/posts/%s", viper.GetString("domain"), post.Alias) err := NotifyAccount( op.Author, fmt.Sprintf("%s replied you", user.Name), @@ -222,11 +222,16 @@ func NewPost( }) for _, account := range accounts { - _ = NotifyAccount( + postUrl := fmt.Sprintf("https://%s/posts/%s", viper.GetString("domain"), post.Alias) + err := NotifyAccount( account, fmt.Sprintf("%s just posted a post", user.Name), "Account you followed post a brand new post. Check it out!", + fiber.Map{"label": "Related post", "url": postUrl}, ) + if err != nil { + log.Error().Err(err).Msg("An error occurred when notifying user...") + } } }()