diff options
author | Eugenia Grieff <egrieff@gitlab.com> | 2019-06-28 09:47:54 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-06-28 09:47:54 +0000 |
commit | f0f3246a2b06a4e0edd7d6e309a21aa559118921 (patch) | |
tree | caf81676373d59e93ef2411f6e14c23f1f23a5bd /app/services | |
parent | dbd86f00599fb127a9aeaca0a875769d3bd2d83f (diff) | |
download | gitlab-ce-f0f3246a2b06a4e0edd7d6e309a21aa559118921.tar.gz |
Do not change updated_at on an issue when reordering on an issue board
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/issuable_base_service.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index 26132f1824a..02de080e0ba 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -205,7 +205,7 @@ class IssuableBaseService < BaseService end if issuable.changed? || params.present? - issuable.assign_attributes(params.merge(updated_by: current_user)) + issuable.assign_attributes(params) if has_title_or_description_changed?(issuable) issuable.assign_attributes(last_edited_at: Time.now, last_edited_by: current_user) @@ -213,11 +213,16 @@ class IssuableBaseService < BaseService before_update(issuable) + # Do not touch when saving the issuable if only changes position within a list. We should call + # this method at this point to capture all possible changes. + should_touch = update_timestamp?(issuable) + + issuable.updated_by = current_user if should_touch # We have to perform this check before saving the issuable as Rails resets # the changed fields upon calling #save. update_project_counters = issuable.project && update_project_counter_caches?(issuable) - if issuable.with_transaction_returning_status { issuable.save } + if issuable.with_transaction_returning_status { issuable.save(touch: should_touch) } # We do not touch as it will affect a update on updated_at field ActiveRecord::Base.no_touching do Issuable::CommonSystemNotesService.new(project, current_user).execute(issuable, old_labels: old_associations[:labels]) @@ -402,4 +407,8 @@ class IssuableBaseService < BaseService def ensure_milestone_available(issuable) issuable.milestone_id = nil unless issuable.milestone_available? end + + def update_timestamp?(issuable) + issuable.changes.keys != ["relative_position"] + end end |