diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-13 00:09:34 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-13 00:09:34 +0000 |
commit | 3cd08f4bf96cda3e9d3abf233095107832b17c20 (patch) | |
tree | dc09a618783a79d70f2a404374d4b850ccf9cc84 /lib/gitlab/background_migration/user_mentions/models/note.rb | |
parent | dd4bee69b7d55620f7dc9db8c36b478bd4959755 (diff) | |
download | gitlab-ce-3cd08f4bf96cda3e9d3abf233095107832b17c20.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/background_migration/user_mentions/models/note.rb')
-rw-r--r-- | lib/gitlab/background_migration/user_mentions/models/note.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/gitlab/background_migration/user_mentions/models/note.rb b/lib/gitlab/background_migration/user_mentions/models/note.rb index fb61de638a8..7a1a0223bc7 100644 --- a/lib/gitlab/background_migration/user_mentions/models/note.rb +++ b/lib/gitlab/background_migration/user_mentions/models/note.rb @@ -20,7 +20,7 @@ module Gitlab belongs_to :project def for_personal_snippet? - noteable.class.name == 'PersonalSnippet' + noteable && noteable.class.name == 'PersonalSnippet' end def for_project_noteable? @@ -32,7 +32,7 @@ module Gitlab end def for_epic? - noteable.class.name == 'Epic' + noteable && noteable_type == 'Epic' end def user_mention_resource_id @@ -43,6 +43,14 @@ module Gitlab id end + def noteable + super unless for_commit? + end + + def for_commit? + noteable_type == "Commit" + end + private def mentionable_params @@ -52,6 +60,8 @@ module Gitlab end def banzai_context_params + return {} unless noteable + { group: noteable.group, label_url_method: :group_epics_url } end end |