Formatting.
This commit is contained in:
parent
18c3ca7844
commit
a61e8ac154
4 changed files with 48 additions and 22 deletions
|
|
@ -217,8 +217,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
activities = []
|
||||
else
|
||||
activities =
|
||||
ActivityPub.fetch_public_activities(params)
|
||||
|> Enum.reverse()
|
||||
ActivityPub.fetch_public_activities(params)
|
||||
|> Enum.reverse()
|
||||
end
|
||||
|
||||
conn
|
||||
|
|
|
|||
|
|
@ -23,16 +23,34 @@ defmodule Pleroma.Web.TwitterAPI.NotificationView do
|
|||
end
|
||||
|
||||
def render("notification.json", %{notifications: notifications, for: user}) do
|
||||
render_many(notifications, Pleroma.Web.TwitterAPI.NotificationView, "notification.json", for: user)
|
||||
render_many(
|
||||
notifications,
|
||||
Pleroma.Web.TwitterAPI.NotificationView,
|
||||
"notification.json",
|
||||
for: user
|
||||
)
|
||||
end
|
||||
|
||||
def render("notification.json", %{notification: %Notification{id: id, seen: seen, activity: activity, inserted_at: created_at}, for: user} = opts) do
|
||||
ntype = case activity.data["type"] do
|
||||
"Create" -> "mention"
|
||||
"Like" -> "like"
|
||||
"Announce" -> "repeat"
|
||||
"Follow" -> "follow"
|
||||
end
|
||||
def render(
|
||||
"notification.json",
|
||||
%{
|
||||
notification: %Notification{
|
||||
id: id,
|
||||
seen: seen,
|
||||
activity: activity,
|
||||
inserted_at: created_at
|
||||
},
|
||||
for: user
|
||||
} = opts
|
||||
) do
|
||||
ntype =
|
||||
case activity.data["type"] do
|
||||
"Create" -> "mention"
|
||||
"Like" -> "like"
|
||||
"Announce" -> "repeat"
|
||||
"Follow" -> "follow"
|
||||
end
|
||||
|
||||
from = get_user(activity.data["actor"], opts)
|
||||
|
||||
%{
|
||||
|
|
@ -40,7 +58,7 @@ defmodule Pleroma.Web.TwitterAPI.NotificationView do
|
|||
"ntype" => ntype,
|
||||
"notice" => ActivityView.render("activity.json", %{activity: activity, for: user}),
|
||||
"from_profile" => UserView.render("show.json", %{user: from, for: user}),
|
||||
"is_seen" => (if seen, do: 1, else: 0),
|
||||
"is_seen" => if(seen, do: 1, else: 0),
|
||||
"created_at" => created_at |> Utils.format_naive_asctime()
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue