This is related to 3158310.

I'm testing this today on drupal/private_message dev-2.x at a91c8f9 and Drupal 8.9.3. No other contrib modules installed.

Steps to reproduce

  1. Enable private message, grant permission to use it and view user profiles to authenticated users.
  2. Create three users.
  3. Sign in as User A, click Create Private Message (private-message/create), and send a message to both User B and User C.
  4. Sign in as User B, click Create Private Message (private-message/create), and send a message to just User C.
  5. Sign in as User C, click Create Private Message (private-message/create), and send a message to just User A.

All of the above messages end up on a single thread for all three users (see attached image).

Proposed resolution

A new thread should be created when a user creates a new private message to a different group of recipients than already exists. When User B sends a message just to User C, User A should not receive it.

I'm not going to set the priority higher than Normal but this seems like a big deal, no? Wouldn't this means that if someone spams and sends private messages with a bunch of recipients, then they'll always be included in discussions between any of those recipients?

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

floydm created an issue. See original summary.

floydm’s picture

Issue summary: View changes
floydm’s picture

Issue summary: View changes
floydm’s picture

I think this is related to some code dropped from src/Mapper/PrivateMessageMapper.php in commit 9e0c4cb for Issue #3154558 1116 Too many tables; MariaDB can only use 61 tables in a join

The dropped section in question began with the comment "Next, do a left join for all rows that don't contain the users, and ensure that there aren't any additional users in selected threads". I may be missing something but I don't see that logic being recreated anywhere else.

floydm’s picture

I believe the attached patch restores the missing and logic fixes the issue of the wrong thread being selected.

Admittedly I am not sure what the broader implications of this change would be on performance or other related tickets.

floydm’s picture

Status: Active » Needs review
deedy243’s picture

Hello Floydm,

It doesn't work for me. Can you help me.

apaderno’s picture

Title: Private message threads collapsed when they shouldn't be. » Private message threads collapsed when they shouldn't be

For some reason, the patch hasn't been queued for tests. I manually added it to the test queue.

artem_sylchuk’s picture

Status: Needs review » Needs work

Thanks @floydm,
Looks like the patch wasn't created against the latest dev version, I'll try updating it and reviewing the code.

artem_sylchuk’s picture

Attached the MR with re-roll of the patch. Additionally I simplified a bit the rest of the method's code.
It was trying to rely on the count of the members (assuming that should be unique).
As we see in @floydm example it didn't work correctly.
So I removed the part doing count comparison.

I will try to add tests for this code.
Also I like the idea of allowing to have multiple threads for the same users (I've seen the patch for that before, will try to find a review it too).

artem_sylchuk’s picture

Looks like my test highlighted another problem:

Exception: Notice: Undefined index: items_count
Drupal\Core\Field\WidgetBase::addMoreSubmit()

It comes from the members widget and the way it is added to the private message form.

  • artem_sylchuk committed 0859086 on 8.x-2.x
    Issue #3164669 by artem_sylchuk, floydm: Private message threads...
artem_sylchuk’s picture

Status: Needs work » Fixed
artem_sylchuk’s picture

Status: Fixed » Closed (fixed)