projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Apply suggestion to lib/pleroma/web/web_finger/web_finger.ex
[akkoma]
/
lib
/
pleroma
/
activity
/
queries.ex
diff --git
a/lib/pleroma/activity/queries.ex
b/lib/pleroma/activity/queries.ex
index 363727c80269567041bc3fcc7b657e63fe5c5233..a34c20343471582e7c0dbb8e0bebd647d5cd83e0 100644
(file)
--- a/
lib/pleroma/activity/queries.ex
+++ b/
lib/pleroma/activity/queries.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.Queries do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Activity.Queries do
@@
-30,11
+30,18
@@
defmodule Pleroma.Activity.Queries do
)
end
)
end
- @spec by_author(query,
String
.t()) :: query
+ @spec by_author(query,
User
.t()) :: query
def by_author(query \\ Activity, %User{ap_id: ap_id}) do
from(a in query, where: a.actor == ^ap_id)
end
def by_author(query \\ Activity, %User{ap_id: ap_id}) do
from(a in query, where: a.actor == ^ap_id)
end
+ def find_by_object_ap_id(activities, object_ap_id) do
+ Enum.find(
+ activities,
+ &(object_ap_id in [is_map(&1.data["object"]) && &1.data["object"]["id"], &1.data["object"]])
+ )
+ end
+
@spec by_object_id(query, String.t() | [String.t()]) :: query
def by_object_id(query \\ Activity, object_id)
@spec by_object_id(query, String.t() | [String.t()]) :: query
def by_object_id(query \\ Activity, object_id)