diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-08-22 00:49:56 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:45:19 -0500 |
commit | 6c3a1729e38264d811c1ccbe25a91b7c9b04ba9d (patch) | |
tree | 11c1187dbe2f8c68732bdd10fc9a22f3af235a99 /app/models | |
parent | c299e9555426e36c4dbb489dcccad3ab6bad2f17 (diff) |
[Privacy] Use reply visibility gating to preserve thread permissions rather than public/private flag on thread
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 |