Fix to reject status quotations other than public and unlisted

This commit is contained in:
noellabo 2020-02-28 07:45:54 +09:00
parent 24e85eda67
commit 8edd8ba895

View file

@ -80,6 +80,7 @@ class Status < ApplicationRecord
validates_with DisallowedHashtagsValidator
validates :reblog, uniqueness: { scope: :account }, if: :reblog?
validates :visibility, exclusion: { in: %w(direct limited) }, if: :reblog?
validates :quote_visibility, inclusion: { in: %w(public unlisted) }, if: :quote?
accepts_nested_attributes_for :poll
@ -176,6 +177,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