From 04daa0b9701cd5b53c3c1fd6529aba05e4189114 Mon Sep 17 00:00:00 2001 From: Yauhen Kotau Date: Mon, 18 Feb 2019 20:08:36 +0300 Subject: Added YouTrack integration Fixes gitlab-org/gitlab-ce#42595 --- app/models/project_services/youtrack_service.rb | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 app/models/project_services/youtrack_service.rb (limited to 'app/models/project_services/youtrack_service.rb') 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 + /(?\b[A-Z][A-Z0-9_]*-\d+)/ + else + /(?\b[A-Z][A-Z0-9_]*-\d+)|(#{Issue.reference_prefix}(?\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 -- cgit v1.2.1