Reputation: 1181
I have followed the adivce here stackoverflow aggregate answer
I am grouping posts together
(shares for same post together, likes for same posts together, regular posts as single activities). What I'm noticing, however, is that I end up with duplicates for a user.
If a user shares a post, and also likes the post, it shows up twice on their getstream feed.
Right now, I have to do filtering on my own backend service with a certain order
(If you share a post, remove the activity if you also liked it).
If you like a post, then remove the regular post.
Is there a better way to solve this problem of duplicates?
Upvotes: 4
Views: 377
Reputation: 4306
One idea that comes to mind: when you post an activity of a share, make sure you send a foreign_id
and time
(sending both will avoid duplicates in our system), then if you also 'like' the activity you could store a like
counter in the activity metadata, and send an update with the foreign_id and incrementing the like
count.
Keep in mind that updates don't push to aggregated feeds or notification feeds, though, so you'd still want to push that 'like' activity to those feeds, too.
Upvotes: 1