diff options
Diffstat (limited to 'app/models/note.rb')
-rw-r--r-- | app/models/note.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index fdc972d9726..fb540d692d1 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -30,7 +30,6 @@ class Note < ApplicationRecord # Aliases to make application_helper#edited_time_ago_with_tooltip helper work properly with notes. # See https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/10392/diffs#note_28719102 - alias_attribute :last_edited_at, :updated_at alias_attribute :last_edited_by, :updated_by # Attribute containing rendered and redacted Markdown as generated by @@ -319,6 +318,7 @@ class Note < ApplicationRecord def noteable_assignee_or_author?(user) return false unless user + return false unless noteable.respond_to?(:author_id) return noteable.assignee_or_author?(user) if [MergeRequest, Issue].include?(noteable.class) noteable.author_id == user.id @@ -348,7 +348,13 @@ class Note < ApplicationRecord !system? end - # Since we're using `updated_at` as `last_edited_at`, it could be touched by transforming / resolving a note. + # We used `last_edited_at` as an alias of `updated_at` before. + # This makes it compatible with the previous way without data migration. + def last_edited_at + super || updated_at + end + + # Since we used `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? @@ -546,7 +552,7 @@ class Note < ApplicationRecord end def skip_notification? - review.present? || author.blocked? || author.ghost? + review.present? || !author.can_trigger_notifications? end private |