about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-09-17 12:05:45 -0500
committerFire Demon <firedemon@creature.cafe>2020-09-17 12:08:35 -0500
commite56e3d187f8ddd3db72fc90c5d200f552d5c1c04 (patch)
tree59204082c7f9731d301716f08865f8639149452c /app/models
parent4a1b8bcf34ce834ee8c30f1ac94c29f4e56a2b41 (diff)
[Filters] Merge thread muting and hiding into a single action
Diffstat (limited to 'app/models')
-rw-r--r--app/models/concerns/account_interactions.rb10
-rw-r--r--app/models/status.rb6
2 files changed, 3 insertions, 13 deletions
diff --git a/app/models/concerns/account_interactions.rb b/app/models/concerns/account_interactions.rb
index 538e92f41..cf8e638e7 100644
--- a/app/models/concerns/account_interactions.rb
+++ b/app/models/concerns/account_interactions.rb
@@ -138,10 +138,8 @@ module AccountInteractions
     mute
   end
 
-  def mute_conversation!(conversation, hidden: false)
-    mute = conversation_mutes.find_or_create_by!(conversation: conversation)
-    mute.update(hidden: hidden) if hidden.present? && mute.hidden? != hidden
-    mute
+  def mute_conversation!(conversation)
+    conversation_mutes.find_or_create_by!(conversation: conversation)
   end
 
   def block_domain!(other_domain)
@@ -202,10 +200,6 @@ module AccountInteractions
     conversation_mutes.where(conversation: conversation).exists?
   end
 
-  def hiding_conversation?(conversation)
-    conversation_mutes.where(conversation: conversation, hidden: true).exists?
-  end
-
   def muting_notifications?(other_account)
     mute_relationships.where(target_account: other_account, hide_notifications: true).exists?
   end
diff --git a/app/models/status.rb b/app/models/status.rb
index 1a98f12c3..83ab58418 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -144,7 +144,7 @@ class Status < ApplicationRecord
   scope :ready_to_publish, -> { unpublished.where('statuses.publish_at IS NOT NULL AND statuses.publish_at < ?', Time.now.utc) }
 
   scope :not_hidden_by_account, ->(account) do
-    left_outer_joins(:mutes, :conversation_mute).where('(status_mutes.account_id IS NULL OR status_mutes.account_id != ?) AND (conversation_mutes.account_id IS NULL OR (conversation_mutes.account_id != ? AND conversation_mutes.hidden = TRUE))', account.id, account.id)
+    left_outer_joins(:mutes, :conversation_mute).where('(status_mutes.account_id IS NULL OR status_mutes.account_id != ?) AND (conversation_mutes.account_id IS NULL OR conversation_mutes.account_id != ?)', account.id, account.id)
   end
 
   cache_associated :application,
@@ -484,10 +484,6 @@ class Status < ApplicationRecord
       ConversationMute.select('conversation_id').where(conversation_id: conversation_ids).where(account_id: account_id).each_with_object({}) { |m, h| h[m.conversation_id] = true }
     end
 
-    def hidden_conversations_map(conversation_ids, account_id)
-      ConversationMute.select('conversation_id').where(conversation_id: conversation_ids, hidden: true).where(account_id: account_id).each_with_object({}) { |m, h| h[m.conversation_id] = true }
-    end
-
     def hidden_statuses_map(status_ids, account_id)
       StatusMute.select('status_id').where(status_id: status_ids).where(account_id: account_id).each_with_object({}) { |m, h| h[m.status_id] = true }
     end