FIX: Use unread post excerpt for topic-level bookmark excerpt (PR #14414)

In the user bookmark list, when we show the excerpt of the bookmark (which is usually just the bookmarked post excerpt), we want to show the first unread post’s excerpt instead for for_topic bookmarks. This is because when the user clicks on that bookmark link, they are taken to the first unread post in the topic, not the OP, as per:



I was curious about last_read_post_number + 1 and made an experiment about splitting topic.

In that case, you may hit post about split:

It might be ok as making calculation to next “normal” post will be more expensive. What do you think?

Oh this is a good point…I just remembered there is an Unread class to do all this calculation, I will use that

we can use date and find next post > read_at && “normal”

Wait that is just a count…I will try and find a nicer way anyway

We can’t use a date, we always use last_read_post_number for these. So I will say Post.where("post_number > last_read_post_number").where(type: regular)