Project

General

Profile

Actions

Defect #41572

open

`updated_by_id` in Journal retains deleted user id instead of being set to `User.anonymous`

Added by Go MAEDA 4 days ago. Updated 2 days ago.

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

0%

Estimated time:
Resolution:
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 4 days ago

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

Updated by Go MAEDA 4 days ago

Here is a patch that fixes this issue.

Before:

After:

Actions #3

Updated by Holger Just 3 days 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 2 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 2 days ago

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

Updated by Go MAEDA 2 days ago

  • File 41572-v2.patch added
Actions #7

Updated by Go MAEDA 2 days ago

Actions

Also available in: Atom PDF