forked from AkkomaGang/akkoma
run mix format
This commit is contained in:
parent
993312cdb3
commit
5eed1ea181
3 changed files with 31 additions and 18 deletions
|
@ -364,15 +364,18 @@ defmodule Pleroma.User do
|
|||
def get_follow_requests_query(%User{} = user) do
|
||||
from(
|
||||
a in Activity,
|
||||
where: fragment(
|
||||
where:
|
||||
fragment(
|
||||
"? ->> 'type' = 'Follow'",
|
||||
a.data
|
||||
),
|
||||
where: fragment(
|
||||
where:
|
||||
fragment(
|
||||
"? ->> 'state' = 'pending'",
|
||||
a.data
|
||||
),
|
||||
where: fragment(
|
||||
where:
|
||||
fragment(
|
||||
"? @> ?",
|
||||
a.data,
|
||||
^%{"object" => user.ap_id}
|
||||
|
@ -385,9 +388,9 @@ defmodule Pleroma.User do
|
|||
reqs = Repo.all(q)
|
||||
|
||||
users =
|
||||
Enum.map(reqs, fn (req) -> req.actor end)
|
||||
|> Enum.uniq
|
||||
|> Enum.map(fn (ap_id) -> get_by_ap_id(ap_id) end)
|
||||
Enum.map(reqs, fn req -> req.actor end)
|
||||
|> Enum.uniq()
|
||||
|> Enum.map(fn ap_id -> get_by_ap_id(ap_id) end)
|
||||
|
||||
{:ok, users}
|
||||
end
|
||||
|
|
|
@ -138,7 +138,13 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
%User{} = follower <- User.get_or_fetch_by_ap_id(follower),
|
||||
{:ok, activity} <- ActivityPub.follow(follower, followed, id, false) do
|
||||
if not User.locked?(followed) do
|
||||
ActivityPub.accept(%{to: [follower.ap_id], actor: followed.ap_id, object: data, local: true})
|
||||
ActivityPub.accept(%{
|
||||
to: [follower.ap_id],
|
||||
actor: followed.ap_id,
|
||||
object: data,
|
||||
local: true
|
||||
})
|
||||
|
||||
User.follow(follower, followed)
|
||||
end
|
||||
|
||||
|
|
|
@ -233,7 +233,11 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
|||
@doc """
|
||||
Makes a follow activity data for the given follower and followed
|
||||
"""
|
||||
def make_follow_data(%User{ap_id: follower_id}, %User{ap_id: followed_id} = followed, activity_id) do
|
||||
def make_follow_data(
|
||||
%User{ap_id: follower_id},
|
||||
%User{ap_id: followed_id} = followed,
|
||||
activity_id
|
||||
) do
|
||||
data = %{
|
||||
"type" => "Follow",
|
||||
"actor" => follower_id,
|
||||
|
|
Loading…
Reference in a new issue