Project

General

Profile

Actions

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.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Issues
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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

clipboard-202410241750-dvuxc.png (29.6 KB) clipboard-202410241750-dvuxc.png Go MAEDA, 2024-10-24 10:50
clipboard-202410241751-epej4.png (31.3 KB) clipboard-202410241751-epej4.png Go MAEDA, 2024-10-24 10:51
41572.patch (1.58 KB) 41572.patch Go MAEDA, 2024-10-24 10:51
41572-v2.patch (2.53 KB) 41572-v2.patch Go MAEDA, 2024-10-26 07:55

Related issues

Related to Redmine - Feature #31505: Mark edited journal notes as "Edited"ClosedGo MAEDA

Actions
Actions #1

Updated by Go MAEDA about 1 month ago

  • Related to Feature #31505: Mark edited journal notes as "Edited" added
Actions #3

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).

Actions #4

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.

Actions #5

Updated by Go MAEDA 29 days ago

  • File deleted (41572-v2.patch)
Actions #6

Updated by Go MAEDA 29 days ago

  • File 41572-v2.patch added
Actions #7

Updated by Go MAEDA 29 days ago

Actions #8

Updated by Holger Just 27 days ago

Thanks, that should work. I like your solution for handling a new installation!

Actions #9

Updated by Go MAEDA 27 days ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Target version set to 6.0.0
  • Resolution set to Fixed

I have committed the fix in r23169.

Holger Just, thank you for reviewing the patch.

Actions

Also available in: Atom PDF