I'm writing custom code to render the user PM inbox, so perhaps this only occurs in non-standard use cases, but I thought I'd report this issue anyway.

When a new thread gets started, all members get added to it via PrivateMessageThread::addMember().
For each member added to the thread, the last access timestamp is set to the current timestamp.
Unless there is a delay in the PHP execution, the "updated" timestamp for the PrivateMessageThread entity will be set to the same (current) timestamp.

However, when the PrivateMessageThreadViewBuilder class decides to set the 'unread-thread' class, it only checks if $last_access_time is smaller than $newest_message_timestamp.
In the case where a user receives a new PM thread, and the thread renders for the very first time for this user, this check does not add the 'unread-thread' class, even though it should.

This can be fixed by checking whether last_access_time <= $newest_message_timestamp, instead of just <.

Alternatively, if a new PrivateMessageThreadAccessTime entity gets created, the timestamp could be set to 0 instead of current time, since the user hasn't actually accessed the thread yet anyway. Not sure if this has unwanted consequences elsewhere though...

Comments

svendecabooter created an issue. See original summary.

svendecabooter’s picture

Status: Active » Needs review
StatusFileSize
new683 bytes

Added a patch that fixes this flaw for me.

jaypan’s picture

Status: Needs review » Fixed

Thank you, the patch has been applied and will become part of the next release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.