diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2017-05-03 08:32:21 +0300 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2017-05-04 04:58:41 +0300 |
commit | 7ad5a1b371f5d319369a6b9d6609c40dea6292c2 (patch) | |
tree | 2df1a0335961fde770dd4e8594a60d8d6841123f /app/services/issuable_base_service.rb | |
parent | b82870afc0031cb830976fb36cd1237c6059397f (diff) |
Add last_edited_at and last_edited_by attributes
Diffstat (limited to 'app/services/issuable_base_service.rb')
-rw-r--r-- | app/services/issuable_base_service.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index 7072d78b28d..889e4508758 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -218,6 +218,13 @@ class IssuableBaseService < BaseService if issuable.changed? || params.present? issuable.assign_attributes(params.merge(updated_by: current_user)) + if has_title_or_description_changed?(issuable) + issuable.assign_attributes(params.merge( + last_edited_at: Time.now, + last_edited_by: current_user + )) + end + before_update(issuable) if issuable.with_transaction_returning_status { issuable.save } @@ -240,6 +247,10 @@ class IssuableBaseService < BaseService old_label_ids.sort != new_label_ids.sort end + def has_title_or_description_changed?(issuable) + issuable.title_changed? || issuable.description_changed? + end + def change_state(issuable) case params.delete(:state_event) when 'reopen' |