This instance will be upgraded to Heptapod 0.27.1 on 2021-12-08 at 22:00 UTC+1 (a few minutes of down time)

Commit 537cd66d authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Add gitlab internal issue tracker service.

parent 991ba7c9cd19
......@@ -181,7 +181,7 @@ def default_headers
end
def add_gon_variables
gon.default_issues_tracker = Project.issues_tracker.default_value
gon.default_issues_tracker = Project.new.default_issue_tracker.to_param
gon.api_version = API::API.version
gon.relative_url_root = Gitlab.config.gitlab.relative_url_root
gon.default_avatar_url = URI::join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s
......
......@@ -9,7 +9,7 @@ class Projects::ServicesController < Projects::ApplicationController
def index
@project.build_missing_services
@services = @project.services.reload
@services = @project.services.where.not(type: 'GitlabIssueTrackerService').reload
end
def edit
......@@ -17,9 +17,6 @@ def edit
def update
if @service.update_attributes(service_params)
if @service.activated? && @service.issue_tracker?
@project.update_attributes(issues_tracker: @service.to_param)
end
redirect_to edit_project_service_path(@project, @service.to_param),
notice: 'Successfully updated.'
else
......
......@@ -77,6 +77,7 @@ class Project < ActiveRecord::Base
has_one :jira_service, dependent: :destroy
has_one :redmine_service, dependent: :destroy
has_one :custom_issue_tracker_service, dependent: :destroy
has_one :gitlab_issue_tracker_service, dependent: :destroy
has_one :forked_project_link, dependent: :destroy, foreign_key: "forked_to_project_id"
......@@ -149,8 +150,6 @@ class Project < ActiveRecord::Base
scope :public_and_internal_only, -> { where(visibility_level: Project.public_and_internal_levels) }
scope :non_archived, -> { where(archived: false) }
enumerize :issues_tracker, in: (Service.issue_tracker_service_list).append(:gitlab), default: :gitlab
state_machine :import_status, initial: :none do
event :import_start do
transition [:none, :finished] => :started
......@@ -317,19 +316,32 @@ def issue_exists?(issue_id)
end
end
def default_issue_tracker
unless gitlab_issue_tracker_service
create_gitlab_issue_tracker_service
end
gitlab_issue_tracker_service
end
def issues_tracker
if external_issue_tracker
external_issue_tracker
else
default_issue_tracker
end
end
def default_issues_tracker?
if external_issue_tracker
false
else
unless self.issues_tracker == Project.issues_tracker.default_value
self.update_attributes(issues_tracker: Project.issues_tracker.default_value)
end
true
end
end
def external_issues_trackers
services.select { |service| service.issue_tracker? }
services.select(&:issue_tracker?).reject(&:default?)
end
def external_issue_tracker
......
class GitlabIssueTrackerService < IssueTrackerService
prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url
def default?
true
end
def to_param
'gitlab'
end
end
......@@ -6,6 +6,10 @@ def category
:issue_tracker
end
def default?
false
end
def project_url
# implement inside child
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment