projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '1559-follow-request-notifications' into 'develop'
[akkoma]
/
lib
/
pleroma
/
web
/
mastodon_api
/
views
/
notification_view.ex
diff --git
a/lib/pleroma/web/mastodon_api/views/notification_view.ex
b/lib/pleroma/web/mastodon_api/views/notification_view.ex
index ae87d47016cd031dab3fd73d7fc36d9058dcc38b..4da1ab67f58385e2548c1e923fb742f09afc5f7b 100644
(file)
--- a/
lib/pleroma/web/mastodon_api/views/notification_view.ex
+++ b/
lib/pleroma/web/mastodon_api/views/notification_view.ex
@@
-51,14
+51,15
@@
defmodule Pleroma.Web.MastodonAPI.NotificationView do
|> Enum.filter(& &1)
|> Kernel.++(move_activities_targets)
|> Enum.filter(& &1)
|> Kernel.++(move_activities_targets)
- UserRelationship.view_relationships_option(reading_user, actors)
+ UserRelationship.view_relationships_option(reading_user, actors,
+ source_mutes_only: opts[:skip_relationships]
+ )
end
end
- opts = %{
- for: reading_user,
- parent_activities: parent_activities,
- relationships: relationships_opt
- }
+ opts =
+ opts
+ |> Map.put(:parent_activities, parent_activities)
+ |> Map.put(:relationships, relationships_opt)
safe_render_many(notifications, NotificationView, "show.json", opts)
end
safe_render_many(notifications, NotificationView, "show.json", opts)
end
@@
-82,12
+83,16
@@
defmodule Pleroma.Web.MastodonAPI.NotificationView do
mastodon_type = Activity.mastodon_notification_type(activity)
mastodon_type = Activity.mastodon_notification_type(activity)
+ render_opts = %{
+ relationships: opts[:relationships],
+ skip_relationships: opts[:skip_relationships]
+ }
+
with %{id: _} = account <-
with %{id: _} = account <-
- AccountView.render("show.json", %{
- user: actor,
- for: reading_user,
- relationships: opts[:relationships]
- }) do
+ AccountView.render(
+ "show.json",
+ Map.merge(render_opts, %{user: actor, for: reading_user})
+ ) do
response = %{
id: to_string(notification.id),
type: mastodon_type,
response = %{
id: to_string(notification.id),
type: mastodon_type,
@@
-98,8
+103,6
@@
defmodule Pleroma.Web.MastodonAPI.NotificationView do
}
}
}
}
- render_opts = %{relationships: opts[:relationships]}
-
case mastodon_type do
"mention" ->
put_status(response, activity, reading_user, render_opts)
case mastodon_type do
"mention" ->
put_status(response, activity, reading_user, render_opts)
@@
-111,16
+114,17
@@
defmodule Pleroma.Web.MastodonAPI.NotificationView do
put_status(response, parent_activity_fn.(), reading_user, render_opts)
"move" ->
put_status(response, parent_activity_fn.(), reading_user, render_opts)
"move" ->
+ # Note: :skip_relationships option being applied to _account_ rendering (here)
put_target(response, activity, reading_user, render_opts)
put_target(response, activity, reading_user, render_opts)
- "follow" ->
- response
-
"pleroma:emoji_reaction" ->
response
|> put_status(parent_activity_fn.(), reading_user, render_opts)
|> put_emoji(activity)
"pleroma:emoji_reaction" ->
response
|> put_status(parent_activity_fn.(), reading_user, render_opts)
|> put_emoji(activity)
+ type when type in ["follow", "follow_request"] ->
+ response
+
_ ->
nil
end
_ ->
nil
end