aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2018-05-28 18:31:48 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2018-06-11 22:15:53 +0000
commit5eed1ea18145b16999b29f0a4c2313784c8cff0e (patch)
tree509dcb428f6a968daf1d417775ec4f3fe3658aac /lib
parent993312cdb3ec219f1cf29e14be97f2b98bc90a9c (diff)
downloadpleroma-5eed1ea18145b16999b29f0a4c2313784c8cff0e.tar.gz
run mix format
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/user.ex35
-rw-r--r--lib/pleroma/web/activity_pub/transmogrifier.ex8
-rw-r--r--lib/pleroma/web/activity_pub/utils.ex6
3 files changed, 31 insertions, 18 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index 1dcb68470..b27397e13 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -364,19 +364,22 @@ defmodule Pleroma.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 @@ 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
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
index dffe2f159..08173f78d 100644
--- a/lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -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
diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex
index 6ce954cd0..64329b710 100644
--- a/lib/pleroma/web/activity_pub/utils.ex
+++ b/lib/pleroma/web/activity_pub/utils.ex
@@ -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,