Skip to content

Commit

Permalink
status: disallow quoting of non-public posts
Browse files Browse the repository at this point in the history
  • Loading branch information
kaniini committed Dec 25, 2022
1 parent a697e1d commit 1cef1eb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/models/status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -213,6 +214,10 @@ def quote?
!quote_id.nil? && quote
end

def quote_visibility
quote&.visibility
end

def within_realtime_window?
created_at >= REAL_TIME_WINDOW.ago
end
Expand Down

0 comments on commit 1cef1eb

Please sign in to comment.