diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/status.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/models/status.rb b/app/models/status.rb index 6ef0b2bdd..c6690c312 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -39,6 +39,10 @@ class Status < ApplicationRecord cache_associated :account, :application, :media_attachments, :tags, :stream_entry, mentions: :account, reblog: [:account, :application, :stream_entry, :tags, :media_attachments, mentions: :account], thread: :account + def reply? + super || !in_reply_to_id.nil? + end + def local? uri.nil? end @@ -47,10 +51,6 @@ class Status < ApplicationRecord !reblog_of_id.nil? end - def reply? - !in_reply_to_id.nil? - end - def verb reblog? ? :share : :post end @@ -105,7 +105,7 @@ class Status < ApplicationRecord def as_public_timeline(account = nil, local_only = false) query = joins('LEFT OUTER JOIN accounts ON statuses.account_id = accounts.id') .where(visibility: :public) - .where('(statuses.in_reply_to_id IS NULL OR statuses.in_reply_to_account_id = statuses.account_id)') + .where('(statuses.reply = false OR statuses.in_reply_to_account_id = statuses.account_id)') .where('statuses.reblog_of_id IS NULL') query = query.where('accounts.domain IS NULL') if local_only @@ -176,8 +176,9 @@ class Status < ApplicationRecord text.strip! spoiler_text&.strip! + self.reply = !(in_reply_to_id.nil? && thread.nil?) unless attributes[:reply] self.reblog = reblog.reblog if reblog? && reblog.reblog? - self.in_reply_to_account_id = (thread.account_id == account_id && thread.reply? ? thread.in_reply_to_account_id : thread.account_id) if reply? + self.in_reply_to_account_id = (thread.account_id == account_id && thread.reply? ? thread.in_reply_to_account_id : thread.account_id) if reply? && !thread.nil? self.visibility = (account.locked? ? :private : :public) if visibility.nil? end |