diff options
author | Yauhen Kotau <yauhen.kotau@psa-software.com> | 2019-02-18 20:08:36 +0300 |
---|---|---|
committer | Yauhen Kotau <yauhen.kotau@psa-software.com> | 2019-02-18 20:08:36 +0300 |
commit | 04daa0b9701cd5b53c3c1fd6529aba05e4189114 (patch) | |
tree | 2680c1b9eca8317168018e2219d7fb718e32848f /app/models/project_services/youtrack_service.rb | |
parent | fe10964a6884162b9272ec3a32a5736c2a997ab2 (diff) | |
download | gitlab-ce-04daa0b9701cd5b53c3c1fd6529aba05e4189114.tar.gz |
Added YouTrack integration
Fixes gitlab-org/gitlab-ce#42595
Diffstat (limited to 'app/models/project_services/youtrack_service.rb')
-rw-r--r-- | app/models/project_services/youtrack_service.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/app/models/project_services/youtrack_service.rb b/app/models/project_services/youtrack_service.rb new file mode 100644 index 00000000000..ed8c0635124 --- /dev/null +++ b/app/models/project_services/youtrack_service.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +class YoutrackService < IssueTrackerService + validates :project_url, :issues_url, :new_issue_url, presence: true, public_url: true, if: :activated? + + prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url + + # {PROJECT-KEY}-{NUMBER} Examples: YT-1, PRJ-1 + def self.reference_pattern(only_long: false) + if only_long + /(?<issue>\b[A-Z][A-Z0-9_]*-\d+)/ + else + /(?<issue>\b[A-Z][A-Z0-9_]*-\d+)|(#{Issue.reference_prefix}(?<issue>\d+))/ + end + end + + def title + if self.properties && self.properties['title'].present? + self.properties['title'] + else + 'YouTrack' + end + end + + def description + if self.properties && self.properties['description'].present? + self.properties['description'] + else + 'YouTrack issue tracker' + end + end + + def self.to_param + 'youtrack' + end +end |