From bf0f6eb62d0f5bd1f0d8e4e2a6e9e8fd3b297b6c Mon Sep 17 00:00:00 2001 From: blackle Date: Thu, 12 Jan 2017 23:54:26 -0500 Subject: Implement a click-to-view spoiler system --- app/models/status.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/models') diff --git a/app/models/status.rb b/app/models/status.rb index d5f52b55c..42abe92e5 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class Status < ApplicationRecord + include ActiveModel::Validations include Paginable include Streamable include Cacheable @@ -27,7 +28,8 @@ class Status < ApplicationRecord validates :account, presence: true validates :uri, uniqueness: true, unless: 'local?' - validates :text, presence: true, length: { maximum: 500 }, if: proc { |s| s.local? && !s.reblog? } + validates :text, presence: true, if: proc { |s| s.local? && !s.reblog? } + validates_with StatusLengthValidator validates :text, presence: true, if: proc { |s| !s.local? && !s.reblog? } validates :reblog, uniqueness: { scope: :account, message: 'of status already exists' }, if: 'reblog?' -- cgit