# Table name: user_blocks
#
# id :integer not null, primary key
-# user_id :bigint(8) not null
-# creator_id :bigint(8) not null
+# user_id :bigint not null
+# creator_id :bigint not null
# reason :text not null
# ends_at :datetime not null
# needs_view :boolean default(FALSE), not null
-# revoker_id :bigint(8)
+# revoker_id :bigint
# created_at :datetime
# updated_at :datetime
# reason_format :enum default("markdown"), not null
class UserBlock < ApplicationRecord
validate :moderator_permissions
- validates :reason, :characters => true
+ validates :reason, :characters => true, :length => { :maximum => 10000 }
validates :deactivates_at, :comparison => { :greater_than_or_equal_to => :ends_at }, :unless => -> { needs_view }
validates :deactivates_at, :absence => true, :if => -> { needs_view }