Implement a click-to-view spoiler system
This commit is contained in:
parent
1761d3f9c3
commit
bf0f6eb62d
18 changed files with 192 additions and 77 deletions
|
@ -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?'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue