From f6d73fea8da56e4f725d7830aa4807a415b527b1 Mon Sep 17 00:00:00 2001 From: rhymes Date: Mon, 7 Dec 2020 18:18:40 +0100 Subject: [PATCH] [Hotfix] Allow blank values for payment_pointer (#11786) --- app/models/user.rb | 2 +- spec/models/user_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 21351d6fc..338e9be50 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -213,7 +213,7 @@ class User < ApplicationRecord validates :inbox_type, inclusion: { in: INBOXES } validates :name, length: { in: 1..100 } validates :password, length: { in: 8..100 }, allow_nil: true - validates :payment_pointer, format: PAYMENT_POINTER_REGEXP, allow_nil: true + validates :payment_pointer, format: PAYMENT_POINTER_REGEXP, allow_blank: true validates :rating_votes_count, presence: true validates :reactions_count, presence: true validates :sign_in_count, presence: true diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 1f960cb76..1344e0ce5 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -191,6 +191,7 @@ RSpec.describe User, type: :model do it { is_expected.not_to allow_value("example.com/value").for(:payment_pointer) } it { is_expected.to allow_value(" $example.com/value ").for(:payment_pointer) } it { is_expected.to allow_value(nil).for(:payment_pointer) } + it { is_expected.to allow_value("").for(:payment_pointer) } it { is_expected.to validate_inclusion_of(:inbox_type).in_array(%w[open private]) }