Skip to content

Commit

Permalink
fix(feed): Properly get reactions from Posts endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
WaDadidou committed Nov 18, 2024
1 parent a586e48 commit 97c83c0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion go/pkg/feed/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,13 @@ func (s *FeedService) Posts(ctx context.Context, req *feedpb.PostsRequest) (*fee
posts := make([]*feedpb.Post, len(dbPostWithExtras))
for idx, dbPost := range dbPostWithExtras {
var reactions []*feedpb.Reaction
reactionsMap := map[string]interface{}{}

reactionsMap := make(map[string]interface{})
if err := json.Unmarshal(dbPost.UserReactions, &reactionsMap); err != nil {
s.conf.Logger.Error("failed to unmarshal UserReactions", zap.String("data", string(dbPost.UserReactions)), zap.Error(err))
continue
}

dbPost.UserReactions.Scan(&reactionsMap)
for icon, users := range reactionsMap {
ownState := false
Expand Down

0 comments on commit 97c83c0

Please sign in to comment.