FIX: when unread reply notification exists don't create new (PR #8921)

From time to time, the user is creating a reply post and then they want to add additional details. They edit an existing post and for example, add a quote from a previous one.

In that situation, if the user to whom reply was directed to already have the unread notification, we should not create the new one.

That behaviour was mentioned here: Reply then edit to add quote notification redundancy - feature - Discourse Meta

GitHub

You’ve signed the CLA, lis2. Thank you! This pull request is ready for review.

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/reply-then-edit-to-add-quote-notification-redundancy/138358/18

Looks good to me!

You can merge both lines :wink:

return if existing_unread_reply_notification = existing_notifications.find { |n| !n.read && n.notification_type == Notification.types[:replied] }

@SamSaffron could you review it? Regis and Robin reviewed and accepted it before our conversation worth 1 million dollars.