Fix invitation links not working when invite request text is required (#15385)

Fixes #15383

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
pull/15392/head
ThibG 2020-12-21 00:47:02 +01:00 committed by GitHub
parent 7bf3c6e57b
commit 6f51fd7435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ class User < ApplicationRecord
has_one :invite_request, class_name: 'UserInviteRequest', inverse_of: :user, dependent: :destroy 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 } 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 :locale, inclusion: I18n.available_locales.map(&:to_s), if: :locale?
validates_with BlacklistedEmailValidator, on: :create validates_with BlacklistedEmailValidator, on: :create