aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/streamer
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2019-11-19 23:22:10 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2019-11-19 23:22:10 +0300
commitba5cc3016514080b4bf7eaefd3e25936c0e222ba (patch)
tree799e826ee738487fcf758fd966cff263f8b491db /lib/pleroma/web/streamer
parent3aaf3aa2c24c6b38d7e49e4861c1294c285db49b (diff)
downloadpleroma-ba5cc3016514080b4bf7eaefd3e25936c0e222ba.tar.gz
[#1335] Implemented notification mutes and reblog mutes as UserRelationships. User to UserRelationship relations and functions refactoring.
Diffstat (limited to 'lib/pleroma/web/streamer')
-rw-r--r--lib/pleroma/web/streamer/worker.ex14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/pleroma/web/streamer/worker.ex b/lib/pleroma/web/streamer/worker.ex
index 020112949..07e677d29 100644
--- a/lib/pleroma/web/streamer/worker.ex
+++ b/lib/pleroma/web/streamer/worker.ex
@@ -129,17 +129,17 @@ defmodule Pleroma.Web.Streamer.Worker do
end
defp should_send?(%User{} = user, %Activity{} = item) do
- related_ap_ids = User.related_ap_ids(user, [:block, :mute])
- blocks = related_ap_ids[:block] || []
- mutes = related_ap_ids[:mute] || []
- reblog_mutes = user.muted_reblogs || []
- recipient_blocks = MapSet.new(blocks ++ mutes)
+ %{block: blocked_ap_ids, mute: muted_ap_ids, reblog_mute: reblog_muted_ap_ids} =
+ User.related_ap_ids(user, [:block, :mute, :reblog_mute])
+
+ recipient_blocks = MapSet.new(blocked_ap_ids ++ muted_ap_ids)
recipients = MapSet.new(item.recipients)
domain_blocks = Pleroma.Web.ActivityPub.MRF.subdomains_regex(user.domain_blocks)
with parent <- Object.normalize(item) || item,
- true <- Enum.all?([blocks, mutes, reblog_mutes], &(item.actor not in &1)),
- true <- Enum.all?([blocks, mutes], &(parent.data["actor"] not in &1)),
+ true <-
+ Enum.all?([blocked_ap_ids, muted_ap_ids, reblog_muted_ap_ids], &(item.actor not in &1)),
+ true <- Enum.all?([blocked_ap_ids, muted_ap_ids], &(parent.data["actor"] not in &1)),
true <- MapSet.disjoint?(recipients, recipient_blocks),
%{host: item_host} <- URI.parse(item.actor),
%{host: parent_host} <- URI.parse(parent.data["actor"]),