Commit 5eed1ea1 authored by kaniini's avatar kaniini

run mix format

parent 993312cd
......@@ -364,19 +364,22 @@ def get_friends(user) do
def get_follow_requests_query(%User{} = user) do
from(
a in Activity,
where: fragment(
"? ->> 'type' = 'Follow'",
a.data
),
where: fragment(
"? ->> 'state' = 'pending'",
a.data
),
where: fragment(
"? @> ?",
a.data,
^%{"object" => user.ap_id}
)
where:
fragment(
"? ->> 'type' = 'Follow'",
a.data
),
where:
fragment(
"? ->> 'state' = 'pending'",
a.data
),
where:
fragment(
"? @> ?",
a.data,
^%{"object" => user.ap_id}
)
)
end
......@@ -385,9 +388,9 @@ def get_follow_requests(%User{} = 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 @@ def handle_incoming(
%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 @@ def update_follow_state(%Activity{} = activity, state) 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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment