diff options
Diffstat (limited to 'app/models/service.rb')
-rw-r--r-- | app/models/service.rb | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/app/models/service.rb b/app/models/service.rb index e5626462dd3..c49e0869b21 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -46,7 +46,6 @@ class Service < ApplicationRecord after_initialize :initialize_properties after_commit :reset_updated_properties - after_commit :cache_project_has_external_issue_tracker belongs_to :project, inverse_of: :services belongs_to :group, inverse_of: :services @@ -55,11 +54,11 @@ class Service < ApplicationRecord validates :project_id, presence: true, unless: -> { template? || instance? || group_id } validates :group_id, presence: true, unless: -> { template? || instance? || project_id } validates :project_id, :group_id, absence: true, if: -> { template? || instance? } - validates :type, uniqueness: { scope: :project_id }, unless: -> { template? || instance? || group_id }, on: :create - validates :type, uniqueness: { scope: :group_id }, unless: -> { template? || instance? || project_id } validates :type, presence: true - validates :template, uniqueness: { scope: :type }, if: -> { template? } - validates :instance, uniqueness: { scope: :type }, if: -> { instance? } + validates :type, uniqueness: { scope: :template }, if: :template? + validates :type, uniqueness: { scope: :instance }, if: :instance? + validates :type, uniqueness: { scope: :project_id }, if: :project_id? + validates :type, uniqueness: { scope: :group_id }, if: :group_id? validate :validate_is_instance_or_template validate :validate_belongs_to_project_or_group @@ -438,10 +437,6 @@ class Service < ApplicationRecord ProjectServiceWorker.perform_async(id, data) end - def external_issue_tracker? - category == :issue_tracker && active? - end - def external_wiki? type == 'ExternalWikiService' && active? end @@ -461,12 +456,6 @@ class Service < ApplicationRecord errors.add(:project_id, 'The service cannot belong to both a project and a group') if project_id && group_id end - def cache_project_has_external_issue_tracker - if project && !project.destroyed? - project.cache_has_external_issue_tracker - end - end - def valid_recipients? activated? && !importing? end |