diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index b0ade7fb4..63a782d59 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -909,7 +909,6 @@ class ProtocolsController < ApplicationController end def set_inline_name_editing - return unless @protocol.initial_draft? return unless can_manage_protocol_draft_in_repository?(@protocol) @inline_editable_title_config = { diff --git a/app/models/protocol.rb b/app/models/protocol.rb index a1a69b3d8..f26da6f07 100644 --- a/app/models/protocol.rb +++ b/app/models/protocol.rb @@ -70,12 +70,10 @@ class Protocol < ApplicationRecord with_options if: :in_repository_published_version? do validates :parent, presence: true validate :parent_type_constraint - validate :versions_same_name_constraint end with_options if: :in_repository_draft? do # Only one draft can exist for each protocol validate :ensure_single_draft - validate :versions_same_name_constraint end with_options if: -> { in_repository? && !parent && !archived_changed?(from: false) } do |protocol| # Active protocol must have unique name inside its team @@ -797,12 +795,6 @@ class Protocol < ApplicationRecord end end - def versions_same_name_constraint - if parent.present? && !parent.name.eql?(name) - errors.add(:base, I18n.t('activerecord.errors.models.protocol.wrong_version_name')) - end - end - def version_number_constraint if Protocol.where(protocol_type: Protocol::REPOSITORY_TYPES) .where.not(id: id) diff --git a/config/locales/en.yml b/config/locales/en.yml index a6e68a6b6..9eb819df6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -166,7 +166,6 @@ en: protocol: unchangable: "Published protocols can not be changed!" wrong_parent_type: "Protocol can only be linked to published protocol!" - wrong_version_name: "Protocol versions should have same name!" wrong_version_number: "Protocol version number should be sequential!" wrong_parent_draft_number: "Procol can have only 1 draft" attributes: