Birth dates, birthday reminders API, allow instance admins to require minimum age
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
84dcb55b0f
commit
b108b05650
16 changed files with 168 additions and 14 deletions
|
|
@ -59,7 +59,9 @@ defmodule Pleroma.User.Query do
|
|||
order_by: term(),
|
||||
select: term(),
|
||||
limit: pos_integer(),
|
||||
actor_types: [String.t()]
|
||||
actor_types: [String.t()],
|
||||
birth_day: pos_integer(),
|
||||
birth_month: pos_integer()
|
||||
}
|
||||
| map()
|
||||
|
||||
|
|
@ -230,6 +232,18 @@ defmodule Pleroma.User.Query do
|
|||
|> where([u], not like(u.nickname, "internal.%"))
|
||||
end
|
||||
|
||||
defp compose_query({:birth_day, day}, query) do
|
||||
query
|
||||
|> where([u], not is_nil(u.birth_date))
|
||||
|> where([u], fragment("date_part('day', ?)", u.birth_date) == ^day)
|
||||
end
|
||||
|
||||
defp compose_query({:birth_month, month}, query) do
|
||||
query
|
||||
|> where([u], not is_nil(u.birth_date))
|
||||
|> where([u], fragment("date_part('month', ?)", u.birth_date) == ^month)
|
||||
end
|
||||
|
||||
defp compose_query(_unsupported_param, query), do: query
|
||||
|
||||
defp location_query(query, local) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue