projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix
[akkoma]
/
lib
/
pleroma
/
activity.ex
diff --git
a/lib/pleroma/activity.ex
b/lib/pleroma/activity.ex
index 37b2c041eb97222588241f13feabe45ad994d9ae..6ca05f74e061ce4739b52fe592db979cc92408b5 100644
(file)
--- a/
lib/pleroma/activity.ex
+++ b/
lib/pleroma/activity.ex
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Activity do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Activity do
@@
-29,7
+29,9
@@
defmodule Pleroma.Activity do
"Create" => "mention",
"Follow" => "follow",
"Announce" => "reblog",
"Create" => "mention",
"Follow" => "follow",
"Announce" => "reblog",
- "Like" => "favourite"
+ "Like" => "favourite",
+ "Move" => "move",
+ "EmojiReact" => "pleroma:emoji_reaction"
}
@mastodon_to_ap_notification_types for {k, v} <- @mastodon_notification_types,
}
@mastodon_to_ap_notification_types for {k, v} <- @mastodon_notification_types,
@@
-253,9
+255,10
@@
defmodule Pleroma.Activity do
def normalize(ap_id) when is_binary(ap_id), do: get_by_ap_id_with_object(ap_id)
def normalize(_), do: nil
def normalize(ap_id) when is_binary(ap_id), do: get_by_ap_id_with_object(ap_id)
def normalize(_), do: nil
- def delete_
by
_ap_id(id) when is_binary(id) do
+ def delete_
all_by_object
_ap_id(id) when is_binary(id) do
id
|> Queries.by_object_id()
id
|> Queries.by_object_id()
+ |> Queries.exclude_type("Delete")
|> select([u], u)
|> Repo.delete_all()
|> elem(1)
|> select([u], u)
|> Repo.delete_all()
|> elem(1)
@@
-267,7
+270,7
@@
defmodule Pleroma.Activity do
|> purge_web_resp_cache()
end
|> purge_web_resp_cache()
end
- def delete_
by
_ap_id(_), do: nil
+ def delete_
all_by_object
_ap_id(_), do: nil
defp purge_web_resp_cache(%Activity{} = activity) do
%{path: path} = URI.parse(activity.data["id"])
defp purge_web_resp_cache(%Activity{} = activity) do
%{path: path} = URI.parse(activity.data["id"])
@@
-305,14
+308,19
@@
defmodule Pleroma.Activity do
|> where([a], fragment("? ->> 'state' = 'pending'", a.data))
end
|> where([a], fragment("? ->> 'state' = 'pending'", a.data))
end
+ def following_requests_for_actor(%Pleroma.User{ap_id: ap_id}) do
+ Queries.by_type("Follow")
+ |> where([a], fragment("?->>'state' = 'pending'", a.data))
+ |> where([a], a.actor == ^ap_id)
+ |> Repo.all()
+ end
+
def restrict_deactivated_users(query) do
deactivated_users =
def restrict_deactivated_users(query) do
deactivated_users =
- from(u in User.Query.build(
deactivated: true
), select: u.ap_id)
+ from(u in User.Query.build(
%{deactivated: true}
), select: u.ap_id)
|> Repo.all()
|> Repo.all()
- from(activity in query,
- where: activity.actor not in ^deactivated_users
- )
+ Activity.Queries.exclude_authors(query, deactivated_users)
end
defdelegate search(user, query, options \\ []), to: Pleroma.Activity.Search
end
defdelegate search(user, query, options \\ []), to: Pleroma.Activity.Search