Comments marked as read (via notifications) still get highlighted as "new comments" inside threads
This is a bit of a confusing interaction between the feature to highlight new comments in threads and marking notifications as read.
For example, say that you visit a thread that currently has 0 comments and post one. At this point, you will have a
TopicVisit with the time you loaded the thread, and
num_comments set to 1 (since posting your own comment updates this).
You then leave the thread, and 2 more people post comments - one in reply to you, and one other top-level comment. You see the reply in your notifications and mark it read, which updates
num_comments on your
TopicVisit to 2.
The thread has 3 comments though, so when you see it in a listing it will be marked with "(1 new)", which should be the other top-level comment. However, if you visit the thread, both that other top-level comment as well as the reply to you (that you've already seen) will be marked with the "new comment" styling (orange left border).
The reason this happens is because the new comment highlighting is based entirely on the time of your
TopicVisit, which was before either of those comments were posted.
The most correct fix for this would probably be to left-join
CommentNotifications for all comments in the thread for the viewer (if they have the "mark new comments" feature enabled), and use
is_unread to determine whether the comments should still be marked as new or not - any comment that successfully joins a notification with
is_unread being false should not be marked as a new one.