Add Undo of Follow Activity insertion
This commit is contained in:
parent
a9b3f99d48
commit
28b203d08f
6 changed files with 51 additions and 6 deletions
|
|
@ -174,6 +174,16 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
Repo.all(query)
|
||||
end
|
||||
|
||||
def fetch_latest_follow(%User{ap_id: follower_id},
|
||||
%User{ap_id: followed_id}) do
|
||||
query = from activity in Activity,
|
||||
where: fragment("? @> ?", activity.data, ^%{type: "Follow", actor: follower_id,
|
||||
object: followed_id}),
|
||||
order_by: [desc: :inserted_at],
|
||||
limit: 1
|
||||
Repo.one(query)
|
||||
end
|
||||
|
||||
def upload(file) do
|
||||
data = Upload.store(file)
|
||||
Repo.insert(%Object{data: data})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue