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:
Diffstat (limited to 'app/models/integrations/asana.rb')
-rw-r--r--app/models/integrations/asana.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/app/models/integrations/asana.rb b/app/models/integrations/asana.rb
index 054f0606dd2..e7634f51ec4 100644
--- a/app/models/integrations/asana.rb
+++ b/app/models/integrations/asana.rb
@@ -59,12 +59,9 @@ module Integrations
def execute(data)
return unless supported_events.include?(data[:object_kind])
- # check the branch restriction is poplulated and branch is not included
branch = Gitlab::Git.ref_name(data[:ref])
- branch_restriction = restrict_to_branch.to_s
- if branch_restriction.present? && branch_restriction.index(branch).nil?
- return
- end
+
+ return unless branch_allowed?(branch)
user = data[:user_name]
project_name = project.full_name
@@ -103,5 +100,13 @@ module Integrations
end
end
end
+
+ private
+
+ def branch_allowed?(branch_name)
+ return true if restrict_to_branch.blank?
+
+ restrict_to_branch.to_s.gsub(/\s+/, '').split(',').include?(branch_name)
+ end
end
end