summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-15 16:57:06 +0200
committerRémy Coutable <remy@rymai.me>2016-09-20 13:58:14 +0200
commit3970640b48fe9647ad97cf795aa2bb44a81d21a8 (patch)
tree1bf9542fc23ef35d2b150cb0c4c34dceea3465b2 /app/services
parent4276172b6977bb83de2dc86ecccd48984e09955c (diff)
downloadgitlab-ce-3970640b48fe9647ad97cf795aa2bb44a81d21a8.tar.gz
Fix note form hint showing slash commands supported for commits
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/services')
-rw-r--r--app/services/notes/slash_commands_service.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/app/services/notes/slash_commands_service.rb b/app/services/notes/slash_commands_service.rb
index 4a9a8a64653..a14898920a1 100644
--- a/app/services/notes/slash_commands_service.rb
+++ b/app/services/notes/slash_commands_service.rb
@@ -5,9 +5,17 @@ module Notes
'MergeRequest' => MergeRequests::UpdateService
}
- def supported?(note)
+ def self.noteable_update_service(note)
+ UPDATE_SERVICES[note.noteable_type]
+ end
+
+ def self.supported?(note, current_user)
noteable_update_service(note) &&
- can?(current_user, :"update_#{note.noteable_type.underscore}", note.noteable)
+ current_user.can?(:"update_#{note.noteable_type.underscore}", note.noteable)
+ end
+
+ def supported?(note)
+ self.class.supported?(note, current_user)
end
def extract_commands(note)
@@ -21,13 +29,7 @@ module Notes
return if command_params.empty?
return unless supported?(note)
- noteable_update_service(note).new(project, current_user, command_params).execute(note.noteable)
- end
-
- private
-
- def noteable_update_service(note)
- UPDATE_SERVICES[note.noteable_type]
+ self.class.noteable_update_service(note).new(project, current_user, command_params).execute(note.noteable)
end
end
end