From 99e7e359af451f82d91fcf7ab6157ebc714a8d32 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 17 Apr 2020 00:13:06 -0500 Subject: [PATCH] flags/appeals: limit flag/appeal reasons to 140 characters. --- app/models/post_appeal.rb | 1 + app/models/post_flag.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/post_appeal.rb b/app/models/post_appeal.rb index c799bc9a8..d758f945f 100644 --- a/app/models/post_appeal.rb +++ b/app/models/post_appeal.rb @@ -6,6 +6,7 @@ class PostAppeal < ApplicationRecord belongs_to :creator, :class_name => "User" belongs_to :post validates_presence_of :reason + validates :reason, presence: true, length: { in: 1..140 } validate :validate_post_is_inactive validate :validate_creator_is_not_limited validates_uniqueness_of :creator_id, :scope => :post_id, :message => "have already appealed this post" diff --git a/app/models/post_flag.rb b/app/models/post_flag.rb index 54d6f445f..f87f512c4 100644 --- a/app/models/post_flag.rb +++ b/app/models/post_flag.rb @@ -10,7 +10,7 @@ class PostFlag < ApplicationRecord belongs_to :creator, class_name: "User" 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_post validates_uniqueness_of :creator_id, :scope => :post_id, :on => :create, :unless => :is_deletion, :message => "have already flagged this post"