Add follow notifications.
This commit is contained in:
parent
3bad294058
commit
464c33e9a1
@ -20,7 +20,7 @@ defmodule Pleroma.Notification do
|
|||||||
Repo.all(query)
|
Repo.all(query)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_notifications(%Activity{id: id, data: %{"to" => to, "type" => type}} = activity) when type in ["Create", "Like", "Announce"] do
|
def create_notifications(%Activity{id: id, data: %{"to" => to, "type" => type}} = activity) when type in ["Create", "Like", "Announce", "Follow"] do
|
||||||
users = User.get_notified_from_activity(activity)
|
users = User.get_notified_from_activity(activity)
|
||||||
|
|
||||||
notifications = Enum.map(users, fn (user) -> create_notification(activity, user) end)
|
notifications = Enum.map(users, fn (user) -> create_notification(activity, user) end)
|
||||||
|
@ -145,6 +145,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||||||
"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})}
|
||||||
|
"Follow" ->
|
||||||
|
%{id: id, type: "follow", created_at: created_at, account: AccountView.render("account.json", %{user: actor})}
|
||||||
_ -> nil
|
_ -> nil
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user