mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 02:11:08 -06:00
DEV: Set limit for Invite#custom_message
This commit is contained in:
parent
b81c13280a
commit
d63ce56252
@ -31,6 +31,7 @@ class Invite < ActiveRecord::Base
|
||||
|
||||
validates_presence_of :invited_by_id
|
||||
validates :email, email: true, allow_blank: true
|
||||
validates :custom_message, length: { maximum: 1000 }
|
||||
validate :ensure_max_redemptions_allowed
|
||||
validate :valid_redemption_count
|
||||
validate :valid_domain, if: :will_save_change_to_domain?
|
||||
|
@ -12,6 +12,7 @@ RSpec.describe Invite do
|
||||
describe "Validators" do
|
||||
it { is_expected.to validate_presence_of :invited_by_id }
|
||||
it { is_expected.to rate_limit }
|
||||
it { is_expected.to validate_length_of(:custom_message).is_at_most(1000) }
|
||||
|
||||
it "allows invites with valid emails" do
|
||||
invite = Fabricate.build(:invite, email: "test@example.com", invited_by: user)
|
||||
|
Loading…
Reference in New Issue
Block a user