th: status: disallow quoting of non-public posts

lolsob-rspec
Ariadne Conill 2022-12-25 03:56:19 +00:00
parent 4681e0c00e
commit 104cf929a5
1 changed files with 5 additions and 0 deletions

View File

@ -89,6 +89,7 @@ class Status < ApplicationRecord
validates :reblog, uniqueness: { scope: :account }, if: :reblog?
validates :visibility, exclusion: { in: %w(direct limited) }, if: :reblog?
validates :content_type, inclusion: { in: %w(text/plain text/markdown text/html) }, allow_nil: true
validates :quote_visibility, inclusion: { in: %w(public unlisted) }, if: :quote?
accepts_nested_attributes_for :poll
@ -213,6 +214,10 @@ class Status < ApplicationRecord
!quote_id.nil? && quote
end
def quote_visibility
quote&.visibility
end
def within_realtime_window?
created_at >= REAL_TIME_WINDOW.ago
end