projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
For existing users, just replace info.
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
activity_pub.ex
diff --git
a/lib/pleroma/web/activity_pub/activity_pub.ex
b/lib/pleroma/web/activity_pub/activity_pub.ex
index 4bfcd32346462a0654655f5ada15bf7d5c4d0a30..4e46e80ea1128b4a2b15745be32ebdc7c678c374 100644
(file)
--- a/
lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/
lib/pleroma/web/activity_pub/activity_pub.ex
@@
-129,12
+129,17
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
end
def fetch_activities_for_context(context, opts \\ %{}) do
end
def fetch_activities_for_context(context, opts \\ %{}) do
- query = from activity in Activity,
- where: fragment("?->>'type' = ? and ?->>'context' = ?", activity.data, "Create", activity.data, ^context),
- order_by: [desc: :id]
+ public = ["https://www.w3.org/ns/activitystreams#Public"]
+ recipients = if opts["user"], do: [opts["user"].ap_id | opts["user"].following] ++ public, else: public
+
+ query = from activity in Activity
query = query
|> restrict_blocked(opts)
query = query
|> restrict_blocked(opts)
- |> restrict_recipients(["https://www.w3.org/ns/activitystreams#Public"], opts["user"])
+ |> restrict_recipients(recipients, opts["user"])
+
+ query = from activity in query,
+ where: fragment("?->>'type' = ? and ?->>'context' = ?", activity.data, "Create", activity.data, ^context),
+ order_by: [desc: :id]
Repo.all(query)
end
Repo.all(query)
end
@@
-268,6
+273,12
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
}
User.insert_or_update_user(user_data)
}
User.insert_or_update_user(user_data)
+ if user = User.get_by_ap_id(ap_id) do
+ User.info_changeset(user, user_data}
+ |> Repo.update
+ else
+ User.insert_or_update_user(user_data)
+ end
end
end
end
end
@@
-278,7
+289,12
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
end
def publish(actor, activity) do
end
def publish(actor, activity) do
- {:ok, followers} = User.get_followers(actor)
+ followers = if actor.follower_address in activity.recipients do
+ {:ok, followers} = User.get_followers(actor)
+ followers
+ else
+ []
+ end
remote_inboxes = (Pleroma.Web.Salmon.remote_users(activity) ++ followers)
|> Enum.filter(fn (user) -> User.ap_enabled?(user) end)
remote_inboxes = (Pleroma.Web.Salmon.remote_users(activity) ++ followers)
|> Enum.filter(fn (user) -> User.ap_enabled?(user) end)