diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/status.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/app/models/status.rb b/app/models/status.rb index 36b3eecf4..826091bb0 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -136,7 +136,6 @@ class Status < ApplicationRecord scope :without_semiprivate, -> { where(semiprivate: false) } scope :reblogs, -> { where('statuses.reblog_of_id IS NOT NULL') } scope :locally_reblogged, -> { where(id: Status.unscoped.local.reblogs.select(:reblog_of_id)) } - scope :public_conversations, -> { joins(:conversation).where(conversations: { public: true }) } scope :conversations_by, ->(account) { joins(:conversation).where(conversations: { account: account }) } scope :mentioning_account, ->(account) { joins(:mentions).where(mentions: { account: account }) } scope :replies, -> { where(reply: true).where('statuses.in_reply_to_account_id != statuses.account_id') } @@ -364,9 +363,9 @@ class Status < ApplicationRecord def should_be_semiprivate? return @should_be_semiprivate if defined?(@should_be_semiprivate) - return @should_be_semiprivate = true if distributable? && (!conversation.public? || private_domain_permissions? || account.private_domain_permissions?) + return @should_be_semiprivate = true if distributable? && (private_domain_permissions? || account.private_domain_permissions?) - @should_be_semiprivate = !distributable? && (conversation.public? || public_domain_permissions? || account.public_domain_permissions?) + @should_be_semiprivate = !distributable? && (public_domain_permissions? || account.public_domain_permissions?) end def should_limit_visibility? @@ -584,7 +583,7 @@ class Status < ApplicationRecord query = if options[:include_replies] query = query.replies if options[:only_replies] - query.public_conversations.or(query.conversations_by(target_account)) + query.conversations_by(target_account) else query.without_replies end @@ -715,14 +714,14 @@ class Status < ApplicationRecord self.in_reply_to_account_id = carried_over_reply_to_account_id self.conversation_id = thread.conversation_id if conversation_id.nil? elsif conversation_id.nil? - self.conversation = reply? ? Conversation.new(account_id: nil, public: false) : Conversation.new(account_id: account_id, public: distributable?) - elsif !reply? && account_id != conversation.account_id || conversation.public? != distributable? - conversation.update!(account_id: account_id, public: distributable?) + self.conversation = reply? ? Conversation.new(account_id: nil) : Conversation.new(account_id: account_id) + elsif !reply? && account_id != conversation.account_id + conversation.update!(account_id: account_id) end end def set_conversation_root - conversation.update!(root: uri, account_id: account_id, public: distributable?) if !reply && conversation.root.blank? + conversation.update!(root: uri, account_id: account_id) if !reply && conversation.root.blank? end def carried_over_reply_to_account_id |