Project

General

Profile

Actions

Patch #40449

open

Add updated_on field in the issue journal

Added by Thomas Hoffmann 22 days ago. Updated 15 days ago.

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

0%

Estimated time:

Description

We would like to synchronize the redmine issues with our internal system via API.
For this purpose, we fetch the issues with:

curl -H "X-Redmine-API-Key: secret" "https://domain.com/issues/58.json?include=children%2Cattachments%2Crelations%2Cchangesets%2Cjournals%2Cwatchers%2Callowed_statuses" -vv

The journal is returned but we can't determine, which entry changed.
Therefore, it would be helpful to not only have the created_on but also the updated_on field.

The file app/views/issues/show.api.rsb needs an extra line at line 61:

...
api.created_on journal.created_on
api.updated_on journal.updated_on
api.private_notes journal.private_notes
...


Related issues

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

Actions
Related to Redmine - Feature #40450: Add API-Request for fetching Journals which has changed since a certain date/timeNew

Actions
Actions #1

Updated by Thomas Hoffmann 22 days ago

I added a PR if this makes life easier:
https://github.com/redmine/redmine/pull/149

Please move issue to Patch or Feature, it's not a defect.

Actions #2

Updated by Go MAEDA 16 days ago

  • Tracker changed from Defect to Patch
  • Affected version deleted (5.1.2)

Thank you for suggesting this improvement.

I believe it would be beneficial to include not only updated_on but also updated_by.

diff --git a/app/views/issues/show.api.rsb b/app/views/issues/show.api.rsb
index 6f23ca4b4..6ca8b2d10 100644
--- a/app/views/issues/show.api.rsb
+++ b/app/views/issues/show.api.rsb
@@ -59,6 +59,8 @@ api.issue do
         api.user(:id => journal.user_id, :name => journal.user.name) unless journal.user.nil?
         api.notes journal.notes
         api.created_on journal.created_on
+        api.updated_on journal.updated_on
+        api.updated_by(:id => journal.user_id, :name => journal.user.name) unless journal.user.nil?
         api.private_notes journal.private_notes
         api.array :details do
           journal.visible_details.each do |detail|
Actions #3

Updated by Go MAEDA 16 days ago

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

Updated by Thomas Hoffmann 15 days ago

api.updated_by looks the same as api.user
So it might not add additional information (?)

Actions #5

Updated by Go MAEDA 15 days ago

Thomas Hoffmann wrote in #note-4:

api.updated_by looks the same as api.user
So it might not add additional information (?)

Sorry, the patch in #note-2 is wrong. It should be as follows. Journal#updated_by stores information who last updated the journal.

diff --git a/app/views/issues/show.api.rsb b/app/views/issues/show.api.rsb
index 6f23ca4b4..2c341163a 100644
--- a/app/views/issues/show.api.rsb
+++ b/app/views/issues/show.api.rsb
@@ -59,6 +59,8 @@ api.issue do
         api.user(:id => journal.user_id, :name => journal.user.name) unless journal.user.nil?
         api.notes journal.notes
         api.created_on journal.created_on
+        api.updated_on journal.updated_on
+        api.updated_by(:id => journal.updated_by.id, :name => journal.updated_by.name) unless journal.updated_by.nil?
         api.private_notes journal.private_notes
         api.array :details do
           journal.visible_details.each do |detail|
Actions #6

Updated by Thomas Hoffmann 15 days ago

Looks fine to me now.
Would be nice to have the patch in one of the upcoming releases.
Thanks for your help :)

Actions #7

Updated by Holger Just 14 days ago

  • Related to Feature #40450: Add API-Request for fetching Journals which has changed since a certain date/time added
Actions

Also available in: Atom PDF