projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'issue/1577' into 'develop'
[akkoma]
/
lib
/
pleroma
/
user
/
query.ex
diff --git
a/lib/pleroma/user/query.ex
b/lib/pleroma/user/query.ex
index 4358907cbd19434a8386b07af422ef3a81ea39fb..ac77aab7134769f4b525c0df9ca4f9304bd9dc1a 100644
(file)
--- a/
lib/pleroma/user/query.ex
+++ b/
lib/pleroma/user/query.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.User.Query do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.User.Query do
@@
-54,13
+54,13
@@
defmodule Pleroma.User.Query do
select: term(),
limit: pos_integer()
}
select: term(),
limit: pos_integer()
}
- |
%{}
+ |
map()
@ilike_criteria [:nickname, :name, :query]
@equal_criteria [:email]
@contains_criteria [:ap_id, :nickname]
@ilike_criteria [:nickname, :name, :query]
@equal_criteria [:email]
@contains_criteria [:ap_id, :nickname]
- @spec build(criteria()) :: Query.t()
+ @spec build(
Query.t(),
criteria()) :: Query.t()
def build(query \\ base_query(), criteria) do
prepare_query(query, criteria)
end
def build(query \\ base_query(), criteria) do
prepare_query(query, criteria)
end
@@
-148,7
+148,7
@@
defmodule Pleroma.User.Query do
as: :relationships,
on: r.following_id == ^id and r.follower_id == u.id
)
as: :relationships,
on: r.following_id == ^id and r.follower_id == u.id
)
- |> where([relationships: r], r.state ==
"accept"
)
+ |> where([relationships: r], r.state ==
^:follow_accept
)
end
defp compose_query({:friends, %User{id: id}}, query) do
end
defp compose_query({:friends, %User{id: id}}, query) do
@@
-158,7
+158,7
@@
defmodule Pleroma.User.Query do
as: :relationships,
on: r.following_id == u.id and r.follower_id == ^id
)
as: :relationships,
on: r.following_id == u.id and r.follower_id == ^id
)
- |> where([relationships: r], r.state ==
"accept"
)
+ |> where([relationships: r], r.state ==
^:follow_accept
)
end
defp compose_query({:recipients_from_activity, to}, query) do
end
defp compose_query({:recipients_from_activity, to}, query) do
@@
-173,7
+173,7
@@
defmodule Pleroma.User.Query do
)
|> where(
[u, following: f, relationships: r],
)
|> where(
[u, following: f, relationships: r],
- u.ap_id in ^to or (f.follower_address in ^to and r.state ==
"accept"
)
+ u.ap_id in ^to or (f.follower_address in ^to and r.state ==
^:follow_accept
)
)
|> distinct(true)
end
)
|> distinct(true)
end