Merge pull request #1229 from Zanz2/unify_match_case_sci1324

Fix protocol names are case insensitive unique [SCI-1324]
This commit is contained in:
Zanz2 2018-07-17 08:22:03 +02:00 committed by GitHub
commit 887ddbfce3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,7 +43,7 @@ class Protocol < ApplicationRecord
with_options if: :in_repository_public? do |protocol|
# Public protocol must have unique name inside its team
protocol
.validates_uniqueness_of :name,
.validates_uniqueness_of :name, case_sensitive: false,
scope: :team,
conditions: -> {
where(
@ -57,7 +57,7 @@ class Protocol < ApplicationRecord
with_options if: :in_repository_private? do |protocol|
# Private protocol must have unique name inside its team & user scope
protocol
.validates_uniqueness_of :name,
.validates_uniqueness_of :name, case_sensitive: false,
scope: [:team, :added_by],
conditions: -> {
where(
@ -70,7 +70,7 @@ class Protocol < ApplicationRecord
with_options if: :in_repository_archived? do |protocol|
# Archived protocol must have unique name inside its team & user scope
protocol
.validates_uniqueness_of :name,
.validates_uniqueness_of :name, case_sensitive: false,
scope: [:team, :added_by],
conditions: -> {
where(