2019-02-18 12:08:36 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class YoutrackService < IssueTrackerService
|
2019-02-21 05:39:44 -05:00
|
|
|
validates :project_url, :issues_url, presence: true, public_url: true, if: :activated?
|
2019-02-18 12:08:36 -05:00
|
|
|
|
2019-06-03 08:52:54 -04:00
|
|
|
# {PROJECT-KEY}-{NUMBER} Examples: YT-1, PRJ-1, gl-030
|
2019-02-18 12:08:36 -05:00
|
|
|
def self.reference_pattern(only_long: false)
|
|
|
|
if only_long
|
2020-02-14 07:09:03 -05:00
|
|
|
/(?<issue>\b[A-Za-z][A-Za-z0-9_]*-\d+\b)/
|
2019-02-18 12:08:36 -05:00
|
|
|
else
|
2020-02-18 07:09:15 -05:00
|
|
|
/(?<issue>\b[A-Za-z][A-Za-z0-9_]*-\d+\b)|(#{Issue.reference_prefix}#{Gitlab::Regex.issue})/
|
2019-02-18 12:08:36 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-26 10:03:57 -04:00
|
|
|
def default_title
|
2019-02-21 05:39:44 -05:00
|
|
|
'YouTrack'
|
2019-02-18 12:08:36 -05:00
|
|
|
end
|
|
|
|
|
2019-06-26 10:03:57 -04:00
|
|
|
def default_description
|
|
|
|
s_('IssueTracker|YouTrack issue tracker')
|
2019-02-18 12:08:36 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.to_param
|
|
|
|
'youtrack'
|
|
|
|
end
|
2019-02-21 05:39:44 -05:00
|
|
|
|
|
|
|
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
|
2019-02-18 12:08:36 -05:00
|
|
|
end
|