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("notification.json", %Notification{} = notify, %User{} = user, topic) do
32 event: "notification",
34 NotificationView.render(
36 %{notification: notify, for: user}
43 def render("update.json", %Activity{} = activity, topic) do
48 Pleroma.Web.MastodonAPI.StatusView.render(
57 def render("follow_relationships_update.json", item, topic) do
60 event: "pleroma:follow_relationships_update",
66 follower_count: item.follower.follower_count,
67 following_count: item.follower.following_count
70 id: item.following.id,
71 follower_count: item.following.follower_count,
72 following_count: item.following.following_count
80 def render("conversation.json", %Participation{} = participation, topic) do
83 event: "conversation",
85 Pleroma.Web.MastodonAPI.ConversationView.render("participation.json", %{
86 participation: participation,
87 for: participation.user