Defect #41572
closed
`updated_by_id` in Journal retains deleted user id instead of being set to `User.anonymous`
Added by Go MAEDA about 1 month ago.
Updated 27 days ago.
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 to Feature #31505: Mark edited journal notes as "Edited" added
Here is a patch that fixes this issue.
Before:
After:
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).
- 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.
- File deleted (
41572-v2.patch)
- File 41572-v2.patch added
Thanks, that should work. I like your solution for handling a new installation!
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Target version set to 6.0.0
- Resolution set to Fixed
Also available in: Atom
PDF