Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-08-12 12:19:29 +0300
committerRémy Coutable <remy@rymai.me>2016-08-13 01:36:47 +0300
commitf393f2dde016edf63b5168eb63405f15d65803eb (patch)
tree12fc300a54c66a8b16b5d22000f493d92f03ba42 /app/services/projects/participants_service.rb
parentaadc5062ebe755aaf3fbb27fdd0af093770c9ce8 (diff)
Simplify the slash commands DSL to store action blocks instead of creating methods
Other improvements: - Ensure slash commands autocomplete doesn't break when noteable_type is not given - Slash commands: improve autocomplete behavior and /due command - We don't display slash commands for note edit forms. - Add tests for reply by email with slash commands - Be sure to execute slash commands after the note creation in Notes::CreateService Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/services/projects/participants_service.rb')
-rw-r--r--app/services/projects/participants_service.rb25
1 files changed, 15 insertions, 10 deletions
diff --git a/app/services/projects/participants_service.rb b/app/services/projects/participants_service.rb
index 02c4eee3d02..1c8f2913e8b 100644
--- a/app/services/projects/participants_service.rb
+++ b/app/services/projects/participants_service.rb
@@ -1,8 +1,11 @@
module Projects
class ParticipantsService < BaseService
- def execute(noteable_type, noteable_id)
- @noteable_type = noteable_type
- @noteable_id = noteable_id
+ attr_reader :noteable_type, :noteable_id
+
+ def execute
+ @noteable_type = params[:type]
+ @noteable_id = params[:type_id]
+
project_members = sorted(project.team.members)
participants = target_owner + participants_in_target + all_members + groups + project_members
participants.uniq
@@ -10,13 +13,15 @@ module Projects
def target
@target ||=
- case @noteable_type
- when "Issue"
- project.issues.find_by_iid(@noteable_id)
- when "MergeRequest"
- project.merge_requests.find_by_iid(@noteable_id)
- when "Commit"
- project.commit(@noteable_id)
+ case noteable_type
+ when 'Issue'
+ IssuesFinder.new(current_user, project_id: project.id, state: 'all').
+ execute.find_by(iid: noteable_id)
+ when 'MergeRequest'
+ MergeRequestsFinder.new(current_user, project_id: project.id, state: 'all').
+ execute.find_by(iid: noteable_id)
+ when 'Commit'
+ project.commit(noteable_id)
else
nil
end