MastoAPI: Fix mentions always being for an anonymous user.
This commit is contained in:
parent
9554436d61
commit
8a1a7191fd
|
@ -183,13 +183,13 @@ def notifications(%{assigns: %{user: user}} = conn, params) do
|
||||||
|> String.replace(~r/(\.\d+)?$/, ".000Z", global: false)
|
|> String.replace(~r/(\.\d+)?$/, ".000Z", global: false)
|
||||||
case activity.data["type"] do
|
case activity.data["type"] do
|
||||||
"Create" ->
|
"Create" ->
|
||||||
%{id: id, type: "mention", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), status: StatusView.render("status.json", %{activity: activity})}
|
%{id: id, type: "mention", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), status: StatusView.render("status.json", %{activity: activity, for: user})}
|
||||||
"Like" ->
|
"Like" ->
|
||||||
liked_activity = Activity.get_create_activity_by_object_ap_id(activity.data["object"])
|
liked_activity = Activity.get_create_activity_by_object_ap_id(activity.data["object"])
|
||||||
%{id: id, type: "favourite", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), status: StatusView.render("status.json", %{activity: liked_activity})}
|
%{id: id, type: "favourite", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), status: StatusView.render("status.json", %{activity: liked_activity, for: user})}
|
||||||
"Announce" ->
|
"Announce" ->
|
||||||
announced_activity = Activity.get_create_activity_by_object_ap_id(activity.data["object"])
|
announced_activity = Activity.get_create_activity_by_object_ap_id(activity.data["object"])
|
||||||
%{id: id, type: "reblog", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), status: StatusView.render("status.json", %{activity: announced_activity})}
|
%{id: id, type: "reblog", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), status: StatusView.render("status.json", %{activity: announced_activity, for: user})}
|
||||||
"Follow" ->
|
"Follow" ->
|
||||||
%{id: id, type: "follow", created_at: created_at, account: AccountView.render("account.json", %{user: actor})}
|
%{id: id, type: "follow", created_at: created_at, account: AccountView.render("account.json", %{user: actor})}
|
||||||
_ -> nil
|
_ -> nil
|
||||||
|
|
Loading…
Reference in New Issue