diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2019-10-17 14:55:04 +1100 |
---|---|---|
committer | Dylan Griffith <dyl.griffith@gmail.com> | 2019-10-23 13:47:24 +1100 |
commit | 6039737e9d013a099bf6f1f851f9d1510faaff84 (patch) | |
tree | 154e4246a99f74acc38e9cf3a5a29f6c9cf72b91 /app/models | |
parent | 50d93f8d1686950fc58dda4823c4835fd0d8c14b (diff) | |
download | gitlab-ce-6039737e9d013a099bf6f1f851f9d1510faaff84.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')
-rw-r--r-- | app/models/discussion.rb | 1 | ||||
-rw-r--r-- | app/models/note.rb | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/app/models/discussion.rb b/app/models/discussion.rb index 0d066d0d99f..b8525f7b135 100644 --- a/app/models/discussion.rb +++ b/app/models/discussion.rb @@ -16,6 +16,7 @@ class Discussion :commit_id, :for_commit?, :for_merge_request?, + :noteable_ability_name, :to_ability_name, :editable?, :visible_for?, diff --git a/app/models/note.rb b/app/models/note.rb index b1829e71017..a0c5414aede 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -350,6 +350,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 |