diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-16 12:09:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-16 12:09:15 +0300 |
commit | b7b44de429911864686599ef1643baf525bf75ec (patch) | |
tree | 5c066cff07a9900bbc4c1907b0563857b4361b40 /app/services/jira_connect_subscriptions | |
parent | 06bcbc77e472a70b8332150a941539c55953ef2b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/jira_connect_subscriptions')
-rw-r--r-- | app/services/jira_connect_subscriptions/create_service.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/services/jira_connect_subscriptions/create_service.rb b/app/services/jira_connect_subscriptions/create_service.rb index 2f31a3c8d4e..d5ab3800dcf 100644 --- a/app/services/jira_connect_subscriptions/create_service.rb +++ b/app/services/jira_connect_subscriptions/create_service.rb @@ -5,13 +5,18 @@ module JiraConnectSubscriptions include Gitlab::Utils::StrongMemoize MERGE_REQUEST_SYNC_BATCH_SIZE = 20 MERGE_REQUEST_SYNC_BATCH_DELAY = 1.minute.freeze - NOT_SITE_ADMIN = 'The Jira user is not a site administrator.' def execute - return error(NOT_SITE_ADMIN, 403) unless can_administer_jira? + if !params[:jira_user] + return error(s_('JiraConnect|Could not fetch user information from Jira. ' \ + 'Check the permissions in Jira and try again.'), 403) + elsif !can_administer_jira? + return error(s_('JiraConnect|The Jira user is not a site administrator. ' \ + 'Check the permissions in Jira and try again.'), 403) + end unless namespace && can?(current_user, :create_jira_connect_subscription, namespace) - return error('Invalid namespace. Please make sure you have sufficient permissions', 401) + return error(s_('JiraConnect|Cannot find namespace. Make sure you have sufficient permissions.'), 401) end create_subscription @@ -20,7 +25,7 @@ module JiraConnectSubscriptions private def can_administer_jira? - @params[:jira_user]&.site_admin? + params[:jira_user]&.site_admin? end def create_subscription |