Defect #41572
closed`updated_by_id` in Journal retains deleted user id instead of being set to `User.anonymous`
0%
Description
In the current implementation of the Redmine Journal model, the updated_by_id
field stores the id of the user who last edited the notes. However, if the user associated with this id is deleted, the id remains pointing to the deleted user.
To ensure consistent behavior across Redmine, the updated_by_id
should be set to User.anonymous.id
when the associated user is deleted.
Steps to Reproduce:
1. Create an issue and add a notes to it.
2. Edit the notes as a specific user, which will set the updated_by_id.
3. Delete the user who last edited the notes.
4. Query the Journal model and check the updated_by_id field. The expected value is User.anonymous.id
, however, it retains the deleted user's id.
Files
Related issues
Updated by Go MAEDA about 1 month ago
- Related to Feature #31505: Mark edited journal notes as "Edited" added
Updated by Go MAEDA about 1 month ago
- File clipboard-202410241750-dvuxc.png clipboard-202410241750-dvuxc.png added
- File clipboard-202410241751-epej4.png clipboard-202410241751-epej4.png added
- File 41572.patch 41572.patch added
Here is a patch that fixes this issue.
Before:
After:
Updated by Holger Just about 1 month ago
We probably need a migration in addition to that to clear the existing fields where a user was previously deleted, e.g. by updating the @updated_by field of all journals where the referenced user does not exist (anymore).
Updated by Go MAEDA 29 days ago
- File 41572-v2.patch added
Holger Just wrote in #note-3:
We probably need a migration in addition to that to clear the existing fields where a user was previously deleted, e.g. by updating the @updated_by field of all journals where the referenced user does not exist (anymore).
I have updated the patch. The new patch includes a migration that sets the anonymous users' id to the updated_by_id
field when it points to a nonexistent user.
Updated by Go MAEDA 29 days ago
- File 41572-v2.patch 41572-v2.patch added
- File deleted (
41572-v2.patch)
Updated by Holger Just 27 days ago
Thanks, that should work. I like your solution for handling a new installation!