formatting

This commit is contained in:
William Pitcock 2019-03-23 00:28:16 +00:00
parent 59518cbcd8
commit a6973a668e
3 changed files with 10 additions and 7 deletions

View File

@ -59,11 +59,12 @@ defmodule Pleroma.Activity do
:inner,
[activity],
o in Object,
on: fragment(
"(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)",
o.data,
activity.data
)
on:
fragment(
"(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)",
o.data,
activity.data
)
)
|> preload([activity, object], object: object)
end

View File

@ -63,7 +63,8 @@ defmodule Pleroma.Web.CommonAPI do
end
def delete(activity_id, user) do
with %Activity{data: %{"object" => _}} = activity <- Activity.get_by_id_with_object(activity_id),
with %Activity{data: %{"object" => _}} = activity <-
Activity.get_by_id_with_object(activity_id),
%Object{} = object <- Object.normalize(activity),
true <- User.superuser?(user) || user.ap_id == object.data["actor"],
{:ok, _} <- unpin(activity_id, user),

View File

@ -17,7 +17,8 @@ defmodule Pleroma.Web.CommonAPI.Utils do
# This is a hack for twidere.
def get_by_id_or_ap_id(id) do
activity = Activity.get_by_id_with_object(id) || Activity.get_create_by_object_ap_id_with_object(id)
activity =
Activity.get_by_id_with_object(id) || Activity.get_create_by_object_ap_id_with_object(id)
activity &&
if activity.data["type"] == "Create" do