summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHeinrich Lee Yu <heinrich@gitlab.com>2019-03-14 12:00:12 +0800
committerHeinrich Lee Yu <heinrich@gitlab.com>2019-03-14 12:46:23 +0800
commitf5f243a0366d7069205c5a5a4ceb326bc0c7180e (patch)
tree076e494087a6be11cab1e45c6f5b472626981427 /app
parenta59b7cee0afc152efba6aa4c430c14c0b038107a (diff)
downloadgitlab-ce-f5f243a0366d7069205c5a5a4ceb326bc0c7180e.tar.gz
Hide "Edited" when note is transformed or resolved
Makes `Note#edited?` return `false` when the note body was not edited
Diffstat (limited to 'app')
-rw-r--r--app/models/note.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 1578ae9c4cc..2c9980b1a0d 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -313,6 +313,14 @@ class Note < ActiveRecord::Base
!system?
end
+ # Since we're using `updated_at` as `last_edited_at`, it could be touched by transforming / resolving a note.
+ # This makes sure it is only marked as edited when the note body is updated.
+ def edited?
+ return false if updated_by.blank?
+
+ super
+ end
+
def cross_reference_not_visible_for?(user)
cross_reference? && !all_referenced_mentionables_allowed?(user)
end