From db0416b3d6e2f4e58a7f4e54348dded8e44d96cb Mon Sep 17 00:00:00 2001 From: moustachu Date: Mon, 24 Jun 2024 21:56:01 +0200 Subject: [PATCH] fix: don't validate phone number uniqueness if nil --- app/models/decidim/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/decidim/user.rb b/app/models/decidim/user.rb index d37d2b8..67d7f37 100644 --- a/app/models/decidim/user.rb +++ b/app/models/decidim/user.rb @@ -46,7 +46,7 @@ def self.all validates :tos_agreement, acceptance: true, allow_nil: false, on: :create validates :tos_agreement, acceptance: true, if: :user_invited? validates :email, :nickname, uniqueness: { scope: :organization }, unless: -> { deleted? || managed? || nickname.blank? } - validates :phone_number, uniqueness: { scope: :phone_country }, unless: -> { new_record? } + validates :phone_number, uniqueness: { scope: :phone_country, allow_nil: true }, unless: -> { new_record? } validate :all_roles_are_valid