diff options
Diffstat (limited to 'app/models/project_services/jira_service.rb')
-rw-r--r-- | app/models/project_services/jira_service.rb | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb index 61ae78a0b95..0728c83005e 100644 --- a/app/models/project_services/jira_service.rb +++ b/app/models/project_services/jira_service.rb @@ -17,10 +17,7 @@ class JiraService < IssueTrackerService # Jira Cloud version is deprecating authentication via username and password. # We should use username/password for Jira Server and email/api_token for Jira Cloud, # for more information check: https://gitlab.com/gitlab-org/gitlab-ce/issues/49936. - - # TODO: we can probably just delegate as part of - # https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 - data_field :username, :password, :url, :api_url, :jira_issue_transition_id + prop_accessor :username, :password, :url, :api_url, :jira_issue_transition_id before_update :reset_password @@ -38,34 +35,24 @@ class JiraService < IssueTrackerService end def initialize_properties - {} - end - - def data_fields - jira_tracker_data || self.build_jira_tracker_data + super do + self.properties = { + url: issues_tracker['url'], + api_url: issues_tracker['api_url'] + } + end end def reset_password - data_fields.password = nil if reset_password? - end - - def set_default_data - return unless issues_tracker.present? - - self.title ||= issues_tracker['title'] - - return if url - - data_fields.url ||= issues_tracker['url'] - data_fields.api_url ||= issues_tracker['api_url'] + self.password = nil if reset_password? end def options url = URI.parse(client_url) { - username: username, - password: password, + username: self.username, + password: self.password, site: URI.join(url, '/').to_s, # Intended to find the root context_path: url.path, auth_type: :basic, |