summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorYauhen Kotau <yauhen.kotau@psa-software.com>2019-02-18 20:08:36 +0300
committerYauhen Kotau <yauhen.kotau@psa-software.com>2019-02-18 20:08:36 +0300
commit04daa0b9701cd5b53c3c1fd6529aba05e4189114 (patch)
tree2680c1b9eca8317168018e2219d7fb718e32848f /app/models
parentfe10964a6884162b9272ec3a32a5736c2a997ab2 (diff)
downloadgitlab-ce-04daa0b9701cd5b53c3c1fd6529aba05e4189114.tar.gz
Added YouTrack integration
Fixes gitlab-org/gitlab-ce#42595
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project.rb1
-rw-r--r--app/models/project_services/youtrack_service.rb36
-rw-r--r--app/models/service.rb1
3 files changed, 38 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index c72d3a3b725..ec6b9b495d4 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -160,6 +160,7 @@ class Project < ActiveRecord::Base
has_one :pushover_service
has_one :jira_service
has_one :redmine_service
+ has_one :youtrack_service
has_one :custom_issue_tracker_service
has_one :bugzilla_service
has_one :gitlab_issue_tracker_service, inverse_of: :project
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
diff --git a/app/models/service.rb b/app/models/service.rb
index 3461e0bfe70..da523bfa426 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -266,6 +266,7 @@ class Service < ActiveRecord::Base
prometheus
pushover
redmine
+ youtrack
slack_slash_commands
slack
teamcity