common api: allow self-liking objects
mastodon allows this, for whatever reason. closes #347.
This commit is contained in:
parent
5fea3d9eca
commit
47f76bf4b1
|
@ -36,7 +36,6 @@ def unrepeat(id_or_ap_id, user) do
|
||||||
|
|
||||||
def favorite(id_or_ap_id, user) do
|
def favorite(id_or_ap_id, user) do
|
||||||
with %Activity{} = activity <- get_by_id_or_ap_id(id_or_ap_id),
|
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
|
object <- Object.normalize(activity.data["object"]["id"]) do
|
||||||
ActivityPub.like(user, object)
|
ActivityPub.like(user, object)
|
||||||
else
|
else
|
||||||
|
@ -47,7 +46,6 @@ def favorite(id_or_ap_id, user) do
|
||||||
|
|
||||||
def unfavorite(id_or_ap_id, user) do
|
def unfavorite(id_or_ap_id, user) do
|
||||||
with %Activity{} = activity <- get_by_id_or_ap_id(id_or_ap_id),
|
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
|
object <- Object.normalize(activity.data["object"]["id"]) do
|
||||||
ActivityPub.unlike(user, object)
|
ActivityPub.unlike(user, object)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue