correctly fixes the duplicated notifications
Yesterday's commit bb44b0cd seems to have been bogus and still resulted in a problem. I've gone over it again and made sure to cover all cases. If any of the two settings are disabled, this whole if clause is ignored anyway. So we only look at if both settings are enabled.
Scenario 1:
User 1 answers and comments, user 2 comments: In this case receiver = answer.author
, type_ == NEW_COMMENT_TO_COMMENT
and is_notification_enabled(NEW_COMMENT_TO_ANSWER
are all true, so we don't add the "new comment to comment" notification.
Scenario 2:
User 1 answers, user 2 comments: The type_
is never NEW_COMMENT_TO_COMMENT
so this also works out.
Scenario 3:
User 3 answers, user 1 comments, user 2 comments: (This is what didn't work in the last commit) Here receiver != answer.author
so the "comment to comment" will be sent correctly.
Is there a scenario I'm missing? For some reason this gave me more issues than it should've.