summaryrefslogtreecommitdiff
path: root/app/models/integrations/jira.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-27 19:01:26 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-27 19:01:26 +0000
commit1ff28a8d8d370efef8bbac2da1edb85b758d4643 (patch)
tree906de1dd9c7637330f2eaea9c1a4217decd9a749 /app/models/integrations/jira.rb
parenta876afc5fd85a4ccae6947941884f3913f472ab0 (diff)
downloadgitlab-ce-1ff28a8d8d370efef8bbac2da1edb85b758d4643.tar.gz
Add latest changes from gitlab-org/security/gitlab@15-2-stable-ee
Diffstat (limited to 'app/models/integrations/jira.rb')
-rw-r--r--app/models/integrations/jira.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/integrations/jira.rb b/app/models/integrations/jira.rb
index c9c9b9d59d6..566bbc456f8 100644
--- a/app/models/integrations/jira.rb
+++ b/app/models/integrations/jira.rb
@@ -223,7 +223,9 @@ module Integrations
# support any events.
end
- def find_issue(issue_key, rendered_fields: false, transitions: false)
+ def find_issue(issue_key, rendered_fields: false, transitions: false, restrict_project_key: false)
+ return if restrict_project_key && parse_project_from_issue_key(issue_key) != project_key
+
expands = []
expands << 'renderedFields' if rendered_fields
expands << 'transitions' if transitions
@@ -321,6 +323,10 @@ module Integrations
private
+ def parse_project_from_issue_key(issue_key)
+ issue_key.gsub(Gitlab::Regex.jira_issue_key_project_key_extraction_regex, '')
+ end
+
def branch_name(commit)
commit.first_ref_by_oid(project.repository)
end