forked from AkkomaGang/akkoma
formatting
This commit is contained in:
parent
59518cbcd8
commit
a6973a668e
3 changed files with 10 additions and 7 deletions
|
@ -59,11 +59,12 @@ def with_preloaded_object(query) 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
|
||||
|
|
|
@ -63,7 +63,8 @@ def reject_follow_request(follower, followed) 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),
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue