Merge branch 'add-muted-to-notifications' into 'develop'
Add `pleroma.is_muted` property to notifications Closes #1812 See merge request pleroma/pleroma!2670
This commit is contained in:
commit
46f7e51b27
3 changed files with 40 additions and 14 deletions
|
|
@ -163,6 +163,13 @@ defmodule Pleroma.Web.ApiSpec.NotificationOperation do
|
|||
description:
|
||||
"Status that was the object of the notification, e.g. in mentions, reblogs, favourites, or polls.",
|
||||
nullable: true
|
||||
},
|
||||
pleroma: %Schema{
|
||||
type: :object,
|
||||
properties: %{
|
||||
is_seen: %Schema{type: :boolean},
|
||||
is_muted: %Schema{type: :boolean}
|
||||
}
|
||||
}
|
||||
},
|
||||
example: %{
|
||||
|
|
@ -170,7 +177,8 @@ defmodule Pleroma.Web.ApiSpec.NotificationOperation do
|
|||
"type" => "mention",
|
||||
"created_at" => "2019-11-23T07:49:02.064Z",
|
||||
"account" => Account.schema().example,
|
||||
"status" => Status.schema().example
|
||||
"status" => Status.schema().example,
|
||||
"pleroma" => %{"is_seen" => false, "is_muted" => false}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -84,12 +84,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationView do
|
|||
|
||||
# Note: :relationships contain user mutes (needed for :muted flag in :status)
|
||||
status_render_opts = %{relationships: opts[:relationships]}
|
||||
|
||||
account =
|
||||
AccountView.render(
|
||||
"show.json",
|
||||
%{user: actor, for: reading_user}
|
||||
)
|
||||
account = AccountView.render("show.json", %{user: actor, for: reading_user})
|
||||
|
||||
response = %{
|
||||
id: to_string(notification.id),
|
||||
|
|
@ -97,6 +92,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationView do
|
|||
created_at: CommonAPI.Utils.to_masto_date(notification.inserted_at),
|
||||
account: account,
|
||||
pleroma: %{
|
||||
is_muted: User.mutes?(reading_user, actor),
|
||||
is_seen: notification.seen
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue