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/project_services/jira_service.rb')
-rw-r--r--app/models/project_services/jira_service.rb23
1 files changed, 8 insertions, 15 deletions
diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb
index 53da874ede8..bb4d35cad22 100644
--- a/app/models/project_services/jira_service.rb
+++ b/app/models/project_services/jira_service.rb
@@ -6,6 +6,8 @@ class JiraService < IssueTrackerService
include ApplicationHelper
include ActionView::Helpers::AssetUrlHelper
+ PROJECTS_PER_PAGE = 50
+
validates :url, public_url: true, presence: true, if: :activated?
validates :api_url, public_url: true, allow_blank: true
validates :username, presence: true, if: :activated?
@@ -201,6 +203,10 @@ class JiraService < IssueTrackerService
add_comment(data, jira_issue)
end
+ def valid_connection?
+ test(nil)[:success]
+ end
+
def test(_)
result = test_settings
success = result.present?
@@ -209,11 +215,6 @@ class JiraService < IssueTrackerService
{ success: success, result: result }
end
- # Jira does not need test data.
- def test_data(_, _)
- nil
- end
-
override :support_close_issue?
def support_close_issue?
true
@@ -413,17 +414,9 @@ class JiraService < IssueTrackerService
# Handle errors when doing Jira API calls
def jira_request
yield
- rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, URI::InvalidURIError, JIRA::HTTPError, OpenSSL::SSL::SSLError => error
+ rescue => error
@error = error
- log_error(
- "Error sending message",
- client_url: client_url,
- error: {
- exception_class: error.class.name,
- exception_message: error.message,
- exception_backtrace: Gitlab::BacktraceCleaner.clean_backtrace(error.backtrace)
- }
- )
+ log_error("Error sending message", client_url: client_url, error: @error.message)
nil
end