summaryrefslogtreecommitdiff
path: root/app/models/note.rb
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2019-10-17 14:55:04 +1100
committerDylan Griffith <dyl.griffith@gmail.com>2019-10-23 11:29:13 +1100
commit0df265b6600c12fb6ed3d068e92e8e2b3ddf0dab (patch)
tree3aa6565afba460f0c731b2517aa413eeebdd046e /app/models/note.rb
parentdffeff5520e861dc6e7319b690c573186bbbd22e (diff)
downloadgitlab-ce-0df265b6600c12fb6ed3d068e92e8e2b3ddf0dab.tar.gz
Change Note#to_ability_name to 'note'
This is to be more consistent as there is already a :read_note policy in NotePolicy. To keep other behaviour the same we've introduced a Note#noteable_ability_name that is used anywhere this was expected.
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 43f349c6fa2..ce60413b8a0 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -361,6 +361,10 @@ class Note < ApplicationRecord
end
def to_ability_name
+ model_name.singular
+ end
+
+ def noteable_ability_name
for_snippet? ? noteable.class.name.underscore : noteable_type.demodulize.underscore
end