Add with_move query param to the notifications API
This commit is contained in:
parent
7722e5a67a
commit
624e720aa4
6 changed files with 55 additions and 15 deletions
|
|
@ -57,6 +57,7 @@ defmodule Pleroma.Notification do
|
|||
|> exclude_muted(user, opts)
|
||||
|> exclude_blocked(user)
|
||||
|> exclude_visibility(opts)
|
||||
|> exclude_move(opts)
|
||||
end
|
||||
|
||||
defp exclude_blocked(query, user) do
|
||||
|
|
@ -81,6 +82,14 @@ defmodule Pleroma.Notification do
|
|||
|> where([n, a, o, tm], is_nil(tm.user_id))
|
||||
end
|
||||
|
||||
defp exclude_move(query, %{with_move: true}) do
|
||||
query
|
||||
end
|
||||
|
||||
defp exclude_move(query, _opts) do
|
||||
where(query, [n, a], fragment("?->>'type' != 'Move'", a.data))
|
||||
end
|
||||
|
||||
@valid_visibilities ~w[direct unlisted public private]
|
||||
|
||||
defp exclude_visibility(query, %{exclude_visibilities: visibility})
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPI do
|
|||
exclude_types: {:array, :string},
|
||||
exclude_visibilities: {:array, :string},
|
||||
reblogs: :boolean,
|
||||
with_muted: :boolean
|
||||
with_muted: :boolean,
|
||||
with_move: :boolean
|
||||
}
|
||||
|
||||
changeset = cast({%{}, param_types}, params, Map.keys(param_types))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue