common api: allow self-liking objects
authorWilliam Pitcock <nenolod@dereferenced.org>
Wed, 31 Oct 2018 22:29:49 +0000 (22:29 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Wed, 31 Oct 2018 22:29:49 +0000 (22:29 +0000)
mastodon allows this, for whatever reason.

closes #347.

lib/pleroma/web/common_api/common_api.ex

index f8fef219fd0b4becbf609a7b90f7f1caced29585..8f47bb12785aa0e12ee092473dfd36a46203b140 100644 (file)
@@ -36,7 +36,6 @@ defmodule Pleroma.Web.CommonAPI do
 
   def favorite(id_or_ap_id, user) do
     with %Activity{} = activity <- get_by_id_or_ap_id(id_or_ap_id),
-         false <- activity.data["actor"] == user.ap_id,
          object <- Object.normalize(activity.data["object"]["id"]) do
       ActivityPub.like(user, object)
     else
@@ -47,7 +46,6 @@ defmodule Pleroma.Web.CommonAPI do
 
   def unfavorite(id_or_ap_id, user) do
     with %Activity{} = activity <- get_by_id_or_ap_id(id_or_ap_id),
-         false <- activity.data["actor"] == user.ap_id,
          object <- Object.normalize(activity.data["object"]["id"]) do
       ActivityPub.unlike(user, object)
     else