Problem/Motivation
When deleting the first message of a thread, the second message will not be shown in the thread.
This problem comes after this commit:
https://git.drupalcode.org/project/private_message/-/commit/4d3384197ab0...
Before, the array returned by getMessages() was always indexed starting on zero and incremented by one. After this commit, the array of messages can be indexed in different ways and when the first message is deleted it will start in 1.
This has an impact in filterUserDeletedMessages() because it relies on the old indexes to slice the array.
Even inside the method getMessages(), it seems that there is a related problem because it is also supposing that the index is always zero for the banned filter.
Steps to reproduce
# Create two messages in a thread;
# Delete the first message;
# Check that both messages disappear from the thread.
Proposed resolution
The array of messages inside getMessages() should be as before, with incremental indexes starting on zero.
Issue fork private_message-3501286
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:
Comments
Comment #3
dxvargas commentedComment #4
claudiu.cristeaDo we need to fix also 3.0.x as #3488508: Thread deletion might leave leftover messages. was merged also there?
Comment #5
dxvargas commentedYes @claudiucristea, I confirm we need a backport for 3.0.x.
Teh code is pretty much the same, in this regards.
Comment #7
claudiu.cristeaBackporting...
Comment #10
claudiu.cristeaThank you for finding and fixing the issue.