Changing issue description thru API get's its updated time reset
Summary
I'm working on writing a conversion script from Unfuddle to Gitlab using the both REST APIs. During an import I first create the ticket and then in a second step add attachments to the project and update the description of an issues markdown text to include the attachment reference.
All works well but when I update the description text of the issue and do the call with "updated_at" set in the request, it get's added to the issue, but a messages is put in the change log (notes): that the description was changed 'now' (date of the issue of the update) not the time I specified. As I'm importing and also with the updated_at explicitly specified I think this should have been reflected in the issue.
Also it seems impossible to close old issues at the time they were originally closed. Mentioning updated_at or closed_at params during the requests are ignored, and closed_at time is always set to 'now'
Same thing happens when adding comments (notes) to the issue, I specify the created_at time but gitlab auto mentions that it was updated at 'now'.
I created a workaround by calling the following from the gitlab rails command line to 'fix' my issues afterwards but this shouldn't have been required I think.
Steps to reproduce
create new issue using the post API with a created_at in the past.
Now update the issues description with a updated_at in the past as well.
YOu will notice a message on the gitlab issue that it was updated just now.
Closing an issue with either closed_at upated_at times are also ignored, and the issue is always closed at now.
Possible fixes
My work around script:
Issue.all.each do | issue |
if (issue.closed_at != nil && issue.closed_at.today?)
issue.closed_at = issue.updated_at
issue.save!
issue.updated_at = issue.closed_at
end
issue.discussions.each do | d |
d.notes.each do | note |
if (note.created_at != note.updated_at)
note.updated_at = note.created_at
note.save!
elsif(note.created_at.today? && issue.closed?)
note.updated_at = issue.closed_at
note.created_at = issue.closed_at
note.save!
end
end
end
end
running on gitlab-ee 10.5.2