projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update Flake ID description
[akkoma]
/
lib
/
pleroma
/
notification.ex
diff --git
a/lib/pleroma/notification.ex
b/lib/pleroma/notification.ex
index bc691dce37d01db11533eb010513b6857a356768..73e19bf970cb3edc5c10fd36fc9e08dbcc059b57 100644
(file)
--- a/
lib/pleroma/notification.ex
+++ b/
lib/pleroma/notification.ex
@@
-79,7
+79,6
@@
defmodule Pleroma.Notification do
|> exclude_notification_muted(user, exclude_notification_muted_opts)
|> exclude_blocked(user, exclude_blocked_opts)
|> exclude_visibility(opts)
|> exclude_notification_muted(user, exclude_notification_muted_opts)
|> exclude_blocked(user, exclude_blocked_opts)
|> exclude_visibility(opts)
- |> exclude_move(opts)
end
defp exclude_blocked(query, user, opts) do
end
defp exclude_blocked(query, user, opts) do
@@
-109,14
+108,6
@@
defmodule Pleroma.Notification do
|> where([n, a, o, tm], is_nil(tm.user_id))
end
|> where([n, a, o, tm], is_nil(tm.user_id))
end
- defp exclude_move(query, %{with_move: true}) do
- query
- end
-
- defp exclude_move(query, _opts) do
- where(query, [n, a], fragment("?->>'type' != 'Move'", a.data))
- end
-
@valid_visibilities ~w[direct unlisted public private]
defp exclude_visibility(query, %{exclude_visibilities: visibility})
@valid_visibilities ~w[direct unlisted public private]
defp exclude_visibility(query, %{exclude_visibilities: visibility})
@@
-293,8
+284,17
@@
defmodule Pleroma.Notification do
end
end
end
end
+ def create_notifications(%Activity{data: %{"type" => "Follow"}} = activity) do
+ if Pleroma.Config.get([:notifications, :enable_follow_request_notifications]) ||
+ Activity.follow_accepted?(activity) do
+ do_create_notifications(activity)
+ else
+ {:ok, []}
+ end
+ end
+
def create_notifications(%Activity{data: %{"type" => type}} = activity)
def create_notifications(%Activity{data: %{"type" => type}} = activity)
- when type in ["Like", "Announce", "
Follow", "
Move", "EmojiReact"] do
+ when type in ["Like", "Announce", "Move", "EmojiReact"] do
do_create_notifications(activity)
end
do_create_notifications(activity)
end
@@
-331,6
+331,8
@@
defmodule Pleroma.Notification do
@doc """
Returns a tuple with 2 elements:
{enabled notification receivers, currently disabled receivers (blocking / [thread] muting)}
@doc """
Returns a tuple with 2 elements:
{enabled notification receivers, currently disabled receivers (blocking / [thread] muting)}
+
+ NOTE: might be called for FAKE Activities, see ActivityPub.Utils.get_notified_from_object/1
"""
def get_notified_from_activity(activity, local_only \\ true)
"""
def get_notified_from_activity(activity, local_only \\ true)
@@
-347,7
+349,7
@@
defmodule Pleroma.Notification do
# Since even subscribers and followers can mute / thread-mute, filtering all above AP IDs
notification_enabled_ap_ids =
potential_receiver_ap_ids
# Since even subscribers and followers can mute / thread-mute, filtering all above AP IDs
notification_enabled_ap_ids =
potential_receiver_ap_ids
- |> exclude_relation
_restricting
_ap_ids(activity)
+ |> exclude_relation
ship_restricted
_ap_ids(activity)
|> exclude_thread_muter_ap_ids(activity)
potential_receivers =
|> exclude_thread_muter_ap_ids(activity)
potential_receivers =
@@
-364,10
+366,10
@@
defmodule Pleroma.Notification do
def get_notified_from_activity(_, _local_only), do: {[], []}
@doc "Filters out AP IDs of users basing on their relationships with activity actor user"
def get_notified_from_activity(_, _local_only), do: {[], []}
@doc "Filters out AP IDs of users basing on their relationships with activity actor user"
- def exclude_relation
_restricting
_ap_ids([], _activity), do: []
+ def exclude_relation
ship_restricted
_ap_ids([], _activity), do: []
- def exclude_relation
_restricting
_ap_ids(ap_ids, %Activity{} = activity) do
- relation_restricted_ap_ids =
+ def exclude_relation
ship_restricted
_ap_ids(ap_ids, %Activity{} = activity) do
+ relation
ship
_restricted_ap_ids =
activity
|> Activity.user_actor()
|> User.incoming_relationships_ungrouped_ap_ids([
activity
|> Activity.user_actor()
|> User.incoming_relationships_ungrouped_ap_ids([
@@
-375,7
+377,7
@@
defmodule Pleroma.Notification do
:notification_mute
])
:notification_mute
])
- Enum.uniq(ap_ids) -- relation_restricted_ap_ids
+ Enum.uniq(ap_ids) -- relation
ship
_restricted_ap_ids
end
@doc "Filters out AP IDs of users who mute activity thread"
end
@doc "Filters out AP IDs of users who mute activity thread"