aboutsummaryrefslogtreecommitdiff
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/push/impl.ex10
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
index bfc8dcd0a..a97bc7569 100644
--- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -132,8 +132,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
json(conn, account)
end
- def user(%{assigns: %{user: for_user}} = conn, %{"id" => id}) do
- with %User{} = user <- Repo.get(User, id),
+ def user(%{assigns: %{user: for_user}} = conn, %{"id" => nickname_or_id}) do
+ with %User{} = user <- User.get_cached_by_nickname_or_id(nickname_or_id),
true <- User.auth_active?(user) || user.id == for_user.id || User.superuser?(for_user) do
account = AccountView.render("account.json", %{user: user, for: for_user})
json(conn, account)
diff --git a/lib/pleroma/web/push/impl.ex b/lib/pleroma/web/push/impl.ex
index 33f912d34..0437ffd00 100644
--- a/lib/pleroma/web/push/impl.ex
+++ b/lib/pleroma/web/push/impl.ex
@@ -20,7 +20,10 @@ defmodule Pleroma.Web.Push.Impl do
@doc "Performs sending notifications for user subscriptions"
@spec perform_send(Notification.t()) :: list(any)
- def perform_send(%{activity: %{data: %{"type" => activity_type}}, user_id: user_id} = notif)
+ def perform_send(
+ %{activity: %{data: %{"type" => activity_type}, id: activity_id}, user_id: user_id} =
+ notif
+ )
when activity_type in @types do
actor = User.get_cached_by_ap_id(notif.activity.data["actor"])
@@ -37,7 +40,10 @@ defmodule Pleroma.Web.Push.Impl do
notification_id: notif.id,
notification_type: type,
icon: avatar_url,
- preferred_locale: "en"
+ preferred_locale: "en",
+ pleroma: %{
+ activity_id: activity_id
+ }
}
|> Jason.encode!()
|> push_message(build_sub(subscription), gcm_api_key, subscription)