flags/appeals: limit flag/appeal reasons to 140 characters.
This commit is contained in:
@@ -6,6 +6,7 @@ class PostAppeal < ApplicationRecord
|
|||||||
belongs_to :creator, :class_name => "User"
|
belongs_to :creator, :class_name => "User"
|
||||||
belongs_to :post
|
belongs_to :post
|
||||||
validates_presence_of :reason
|
validates_presence_of :reason
|
||||||
|
validates :reason, presence: true, length: { in: 1..140 }
|
||||||
validate :validate_post_is_inactive
|
validate :validate_post_is_inactive
|
||||||
validate :validate_creator_is_not_limited
|
validate :validate_creator_is_not_limited
|
||||||
validates_uniqueness_of :creator_id, :scope => :post_id, :message => "have already appealed this post"
|
validates_uniqueness_of :creator_id, :scope => :post_id, :message => "have already appealed this post"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class PostFlag < ApplicationRecord
|
|||||||
|
|
||||||
belongs_to :creator, class_name: "User"
|
belongs_to :creator, class_name: "User"
|
||||||
belongs_to :post
|
belongs_to :post
|
||||||
validates_presence_of :reason
|
validates :reason, presence: true, length: { in: 1..140 }
|
||||||
validate :validate_creator_is_not_limited, on: :create
|
validate :validate_creator_is_not_limited, on: :create
|
||||||
validate :validate_post
|
validate :validate_post
|
||||||
validates_uniqueness_of :creator_id, :scope => :post_id, :on => :create, :unless => :is_deletion, :message => "have already flagged this post"
|
validates_uniqueness_of :creator_id, :scope => :post_id, :on => :create, :unless => :is_deletion, :message => "have already flagged this post"
|
||||||
|
|||||||
Reference in New Issue
Block a user