1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.StreamerView do
9 alias Pleroma.Conversation.Participation
10 alias Pleroma.Notification
12 alias Pleroma.Web.MastodonAPI.NotificationView
14 def render("update.json", %Activity{} = activity, %User{} = user, topic) do
19 Pleroma.Web.MastodonAPI.StatusView.render(
29 def render("status_update.json", %Activity{} = activity, %User{} = user, topic) do
30 activity = Activity.get_create_by_object_ap_id_with_object(activity.object.data["id"])
34 event: "status.update",
36 Pleroma.Web.MastodonAPI.StatusView.render(
46 def render("notification.json", %Notification{} = notify, %User{} = user, topic) do
49 event: "notification",
51 NotificationView.render(
53 %{notification: notify, for: user}
60 def render("update.json", %Activity{} = activity, topic) do
65 Pleroma.Web.MastodonAPI.StatusView.render(
74 def render("status_update.json", %Activity{} = activity, topic) do
75 activity = Activity.get_create_by_object_ap_id_with_object(activity.object.data["id"])
79 event: "status.update",
81 Pleroma.Web.MastodonAPI.StatusView.render(
90 def render("follow_relationships_update.json", item, topic) do
93 event: "pleroma:follow_relationships_update",
99 follower_count: item.follower.follower_count,
100 following_count: item.follower.following_count
103 id: item.following.id,
104 follower_count: item.following.follower_count,
105 following_count: item.following.following_count
113 def render("conversation.json", %Participation{} = participation, topic) do
116 event: "conversation",
118 Pleroma.Web.MastodonAPI.ConversationView.render("participation.json", %{
119 participation: participation,
120 for: participation.user