Link to block a user has cache issues

Created on 22 November 2024, 5 months ago

Problem/Motivation

The default view of a thread shows the Member(s).

The problem is that the information for each member is being cached and seen the same in different threads and even user sessions!

Steps to reproduce

  1. In admin/structure/private-message/private-message-thread/display Member(s) should have Display Type "Entity". This is by default and I haven't tested in any other way.
  2. Login user 1 and user 2 in two different browser sessions. Each one should always navigate using their own session.
  3. User 1 creates a thread with user 2 and 3, the thread gets the ID 1.
  4. User 1 goes to private-messages/1.
  5. User 2 creates a thread with user 3, the thread gets the ID 2.
  6. User 2 goes to private-messages/2. Here there is a problem already, because the link to block/ban the user 3 will have the destination private-messages/1.
  7. Clear cache
  8. User 2 refreshes the page private-messages/2. Now the link to block/ban the user 1 is shown with a correct destination.
  9. User 1 refreshes the page private-messages/1. Now the link to block/ban the user 2 is missing. Also, the destination in the link to block/ban the user 3 is private-messages/2.

Note: Adding 2 users in thread can be really difficult! It seems random and I try until I succeed. I believe this is related to https://www.drupal.org/project/private_message/issues/3212104 🐛 Sending private message to more than one recipient does not work Needs work .

Proposed resolution

Add 'contexts' => ['user'], in $build['block_user']['#cache'] in private_message_user_view().

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇵🇹Portugal dxvargas

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024