From 33913f9b8fef1f8df45dc26239faf8fa4cffc982 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 26 Jan 2015 22:08:27 -0800 Subject: Make issue tracker service fields required. --- app/models/project.rb | 2 +- app/models/project_services/issue_tracker_service.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/project.rb b/app/models/project.rb index de31f14b98e..43b61897a3c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -319,7 +319,7 @@ class Project < ActiveRecord::Base end def external_issues_trackers - services.select { |service| service.category == :issue_tracker } + services.select { |service| service.issue_tracker? } end def external_issue_tracker diff --git a/app/models/project_services/issue_tracker_service.rb b/app/models/project_services/issue_tracker_service.rb index 7ff6e0f284d..fc7b2fe5acd 100644 --- a/app/models/project_services/issue_tracker_service.rb +++ b/app/models/project_services/issue_tracker_service.rb @@ -1,5 +1,7 @@ class IssueTrackerService < Service + validates :project_url, :issues_url, :new_issue_url, presence: true, if: :activated? + def category :issue_tracker end @@ -34,6 +36,8 @@ class IssueTrackerService < Service issues_url: issues_tracker['issues_url'], new_issue_url: issues_tracker['new_issue_url'] } + else + self.properties = {} end end end -- cgit v1.2.1