summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/mastodon_api/mastodon_api_controller.ex4
-rw-r--r--lib/pleroma/web/twitter_api/views/notification_view.ex36
2 files changed, 29 insertions, 11 deletions
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
index 10531ec15..8b3492332 100644
--- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -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
diff --git a/lib/pleroma/web/twitter_api/views/notification_view.ex b/lib/pleroma/web/twitter_api/views/notification_view.ex
index 4e1ba0b54..f41edea0b 100644
--- a/lib/pleroma/web/twitter_api/views/notification_view.ex
+++ b/lib/pleroma/web/twitter_api/views/notification_view.ex
@@ -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