diff options
author | Felipe Artur <felipefac@gmail.com> | 2016-09-29 18:11:32 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-10-26 15:02:16 -0200 |
commit | c2d6822e942f86422348fe4ebea7142822e5882c (patch) | |
tree | 0891efe343661528c89c995eda73c2750f1eca05 /app/models/project_services/issue_tracker_service.rb | |
parent | f4bc18d237413ac55e32ce16a23b3d2ab35a6976 (diff) | |
download | gitlab-ce-c2d6822e942f86422348fe4ebea7142822e5882c.tar.gz |
Finish updates to use JIRA gem
Code improvements, bug fixes, finish documentation and specs
Diffstat (limited to 'app/models/project_services/issue_tracker_service.rb')
-rw-r--r-- | app/models/project_services/issue_tracker_service.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/app/models/project_services/issue_tracker_service.rb b/app/models/project_services/issue_tracker_service.rb index b26ddd518d7..207bb816ad1 100644 --- a/app/models/project_services/issue_tracker_service.rb +++ b/app/models/project_services/issue_tracker_service.rb @@ -1,6 +1,4 @@ class IssueTrackerService < Service - validates :project_url, :issues_url, :new_issue_url, presence: true, url: true, if: :activated? - default_value_for :category, 'issue_tracker' # Pattern used to extract links from comments @@ -38,18 +36,24 @@ class IssueTrackerService < Service ] end - def initialize_properties - if properties.nil? - if enabled_in_gitlab_config + # Initialize with default properties values + # or receive a block with custom properties + def initialize_properties(&block) + return unless properties.nil? + + if enabled_in_gitlab_config + if block_given? + yield + else self.properties = { title: issues_tracker['title'], project_url: issues_tracker['project_url'], issues_url: issues_tracker['issues_url'], new_issue_url: issues_tracker['new_issue_url'] } - else - self.properties = {} end + else + self.properties = {} end end |