From 86db06511768bc387376548d81f6e8e235b8fb6a Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 26 Jan 2025 20:06:35 +0800 Subject: [PATCH] :loud_sound: Verbose updating image visibility --- pkg/internal/services/posts.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/internal/services/posts.go b/pkg/internal/services/posts.go index c37c43d..5604f60 100644 --- a/pkg/internal/services/posts.go +++ b/pkg/internal/services/posts.go @@ -499,12 +499,14 @@ func EditPost(item models.Post) (models.Post, error) { func updatePostAttachmentVisibility(item models.Post) error { if item.Publisher.AccountID == nil { + log.Warn().Msg("Post publisher did not have account id, skip updating attachments visibility...") return nil } if val, ok := item.Body["attachments"].([]string); ok && len(val) > 0 { conn, err := gap.Nx.GetClientGrpcConn("uc") if err != nil { + log.Error().Err(err).Msg("An error occurred when getting grpc connection to Paperclip...") return nil } @@ -516,6 +518,11 @@ func updatePostAttachmentVisibility(item models.Post) error { UserId: lo.ToPtr(uint64(*item.Publisher.AccountID)), IsIndexable: item.Visibility == models.PostVisibilityAll, }) + + if err != nil { + log.Error().Any("attachments", val).Err(err).Msg("An error occurred when updating post attachment visibility...") + return err + } } return nil