diff options
author | Sean McGivern <sean@gitlab.com> | 2019-02-26 18:06:29 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-02-26 18:06:29 +0300 |
commit | f26cd63b0f7e9acc29a72d81ad2ed327ac93b816 (patch) | |
tree | ce020410597306f75bc85f21ea9747a513301495 /app/models/project_services | |
parent | b770a70ab803d9b019a8b73828e353ac097c5083 (diff) | |
parent | 1d388205d52f129bda6890edf3f3fa95d4d63b7c (diff) |
Merge branch 'add_YouTrack_integration' into 'master'
Added YouTrack integration
Closes #42595
See merge request gitlab-org/gitlab-ce!25361
Diffstat (limited to 'app/models/project_services')
-rw-r--r-- | app/models/project_services/youtrack_service.rb | 40 |
1 files changed, 40 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..957be685aea --- /dev/null +++ b/app/models/project_services/youtrack_service.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +class YoutrackService < IssueTrackerService + validates :project_url, :issues_url, presence: true, public_url: true, if: :activated? + + prop_accessor :description, :project_url, :issues_url + + # {PROJECT-KEY}-{NUMBER} Examples: YT-1, PRJ-1 + def self.reference_pattern(only_long: false) + if only_long + /(?<issue>\b[A-Z][A-Za-z0-9_]*-\d+)/ + else + /(?<issue>\b[A-Z][A-Za-z0-9_]*-\d+)|(#{Issue.reference_prefix}(?<issue>\d+))/ + end + end + + def title + 'YouTrack' + 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 + + def fields + [ + { type: 'text', name: 'description', placeholder: description }, + { type: 'text', name: 'project_url', placeholder: 'Project url', required: true }, + { type: 'text', name: 'issues_url', placeholder: 'Issue url', required: true } + ] + end +end |