🐛 Trying to fix update post attachment visibility issue
This commit is contained in:
parent
2bb979668c
commit
7a6dfeb9e6
@ -505,7 +505,7 @@ func updatePostAttachmentVisibility(item models.Post) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if val, ok := item.Body["attachments"].([]string); ok && len(val) > 0 {
|
if val, ok := item.Body["attachments"].([]any); ok && len(val) > 0 {
|
||||||
conn, err := gap.Nx.GetClientGrpcConn("uc")
|
conn, err := gap.Nx.GetClientGrpcConn("uc")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("An error occurred when getting grpc connection to Paperclip...")
|
log.Error().Err(err).Msg("An error occurred when getting grpc connection to Paperclip...")
|
||||||
@ -516,7 +516,9 @@ func updatePostAttachmentVisibility(item models.Post) error {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
resp, err := pc.UpdateVisibility(ctx, &pproto.UpdateVisibilityRequest{
|
resp, err := pc.UpdateVisibility(ctx, &pproto.UpdateVisibilityRequest{
|
||||||
Rid: val,
|
Rid: lo.Map(val, func(item any, _ int) string {
|
||||||
|
return item.(string)
|
||||||
|
}),
|
||||||
UserId: lo.ToPtr(uint64(*item.Publisher.AccountID)),
|
UserId: lo.ToPtr(uint64(*item.Publisher.AccountID)),
|
||||||
IsIndexable: item.Visibility == models.PostVisibilityAll,
|
IsIndexable: item.Visibility == models.PostVisibilityAll,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user