From 6f51fd743590c8fd8dd95e48dc24e4472d46480b Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 21 Dec 2020 00:47:02 +0100 Subject: Fix invitation links not working when invite request text is required (#15385) Fixes #15383 Co-authored-by: Claire --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 6088f1994..dd96bbf8c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -83,7 +83,7 @@ class User < ApplicationRecord has_one :invite_request, class_name: 'UserInviteRequest', inverse_of: :user, dependent: :destroy accepts_nested_attributes_for :invite_request, reject_if: ->(attributes) { attributes['text'].blank? && !Setting.require_invite_text } - validates :invite_request, presence: true, on: :create, if: -> { Setting.require_invite_text } + validates :invite_request, presence: true, on: :create, if: -> { Setting.require_invite_text && !invited? } validates :locale, inclusion: I18n.available_locales.map(&:to_s), if: :locale? validates_with BlacklistedEmailValidator, on: :create -- cgit