1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.PleromaAPI.SubscriptionNotificationView do
9 alias Pleroma.Web.CommonAPI
10 alias Pleroma.Web.MastodonAPI.AccountView
11 alias Pleroma.Web.MastodonAPI.StatusView
12 alias Pleroma.Web.PleromaAPI.SubscriptionNotificationView
14 def render("index.json", %{notifications: notifications, for: user}) do
15 safe_render_many(notifications, SubscriptionNotificationView, "show.json", %{for: user})
18 def render("show.json", %{
19 subscription_notification: %{
20 notification: %{activity: activity} = notification,
22 parent_activity: parent_activity
26 mastodon_type = Activity.mastodon_notification_type(activity)
29 id: to_string(notification.id),
31 created_at: CommonAPI.Utils.to_masto_date(notification.inserted_at),
32 account: AccountView.render("account.json", %{user: actor, for: user})
39 status: StatusView.render("status.json", %{activity: activity, for: user})
45 status: StatusView.render("status.json", %{activity: parent_activity, for: user})
51 status: StatusView.render("status.json", %{activity: parent_activity, for: user})