When merging posts, likes of the posts being merged do not add up to the final post

Hi @codinghorror,
I was looking through this bug. I found out when we do merge_posts, we pseudo_delete all posts except one which becomes the merged post.

So for all the posts except merged_post, we delete their user_actions for was_liked. So to transfer likes, I will have to get all the was_liked actions for deleted_posts. Out of those likes, users which haven’t liked the merged_post, we can create user_action for them corresponding to merged_post.

What do you think about this approach?

Also, there is an option to recover post. When that happens, all was_liked actions are re-created too using post_action. In that case, the merged post will have new likes equal to likes to all the merged posts and recovered_post will also get back its likes thus increasing number of likes.

Thanks

4 лайка