Add follow notifications.
authorRoger Braun <roger@rogerbraun.net>
Mon, 11 Sep 2017 18:53:11 +0000 (20:53 +0200)
committerRoger Braun <roger@rogerbraun.net>
Mon, 11 Sep 2017 18:53:11 +0000 (20:53 +0200)
lib/pleroma/notification.ex
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex

index 8cd09ad8e8d6c4408269e86db6d5d21c3027fe16..4a9e835bf15ea627227a190340c310e485aee473 100644 (file)
@@ -20,7 +20,7 @@ defmodule Pleroma.Notification do
     Repo.all(query)
   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)
 
     notifications = Enum.map(users, fn (user) -> create_notification(activity, user) end)
index 8111621961e534fba457eeb39f82cd895ed503e5..9e4d13b3acf975312335a8b73b36c1096796ad45 100644 (file)
@@ -145,6 +145,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
         "Announce" ->
           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})}
+        "Follow" ->
+          %{id: id, type: "follow", created_at: created_at, account: AccountView.render("account.json", %{user: actor})}
         _ -> nil
       end
     end)