about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorblackle <isabelle@blackle-mori.com>2017-01-12 23:54:26 -0500
committerblackle <isabelle@blackle-mori.com>2017-01-23 21:07:40 -0500
commitbf0f6eb62d0f5bd1f0d8e4e2a6e9e8fd3b297b6c (patch)
treec06ebcba34c5971d564beb98aa81d5d9784ec2c7 /app/models
parent1761d3f9c33f3e2e98a09906fae1a03783b54b10 (diff)
Implement a click-to-view spoiler system
Diffstat (limited to 'app/models')
-rw-r--r--app/models/status.rb4
1 files changed, 3 insertions, 1 deletions
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?'