projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove PurgeExpiredActivity from Oban db config
[akkoma]
/
lib
/
pleroma
/
web
/
controller_helper.ex
diff --git
a/lib/pleroma/web/controller_helper.ex
b/lib/pleroma/web/controller_helper.ex
index 69946fb81ee6a5571728586e8c8fbde681ccb351..69188a882049de1af680d78bc1aebecff6319e67 100644
(file)
--- a/
lib/pleroma/web/controller_helper.ex
+++ b/
lib/pleroma/web/controller_helper.ex
@@
-18,6
+18,12
@@
defmodule Pleroma.Web.ControllerHelper do
def truthy_param?(value), do: not falsy_param?(value)
def truthy_param?(value), do: not falsy_param?(value)
+ def json_response(conn, status, _) when status in [204, :no_content] do
+ conn
+ |> put_resp_header("content-type", "application/json")
+ |> send_resp(status, "")
+ end
+
def json_response(conn, status, json) do
conn
|> put_status(status)
def json_response(conn, status, json) do
conn
|> put_status(status)
@@
-42,13
+48,13
@@
defmodule Pleroma.Web.ControllerHelper do
defp param_to_integer(_, default), do: default
defp param_to_integer(_, default), do: default
- def add_link_headers(conn,
activit
ies, extra_params \\ %{})
+ def add_link_headers(conn,
entr
ies, extra_params \\ %{})
- def add_link_headers(%{assigns: %{skip_link_headers: true}} = conn, _
activit
ies, _extra_params),
+ def add_link_headers(%{assigns: %{skip_link_headers: true}} = conn, _
entr
ies, _extra_params),
do: conn
do: conn
- def add_link_headers(conn,
activit
ies, extra_params) do
- case get_pagination_fields(conn,
activit
ies, extra_params) do
+ def add_link_headers(conn,
entr
ies, extra_params) do
+ case get_pagination_fields(conn,
entr
ies, extra_params) do
%{"next" => next_url, "prev" => prev_url} ->
put_resp_header(conn, "link", "<#{next_url}>; rel=\"next\", <#{prev_url}>; rel=\"prev\"")
%{"next" => next_url, "prev" => prev_url} ->
put_resp_header(conn, "link", "<#{next_url}>; rel=\"next\", <#{prev_url}>; rel=\"prev\"")
@@
-72,19
+78,15
@@
defmodule Pleroma.Web.ControllerHelper do
}
end
}
end
- def get_pagination_fields(conn,
activit
ies, extra_params \\ %{}) do
- case List.last(
activit
ies) do
+ def get_pagination_fields(conn,
entr
ies, extra_params \\ %{}) do
+ case List.last(
entr
ies) do
%{pagination_id: max_id} when not is_nil(max_id) ->
%{pagination_id: max_id} when not is_nil(max_id) ->
- %{pagination_id: min_id} =
- activities
- |> List.first()
+ %{pagination_id: min_id} = List.first(entries)
build_pagination_fields(conn, min_id, max_id, extra_params)
%{id: max_id} ->
build_pagination_fields(conn, min_id, max_id, extra_params)
%{id: max_id} ->
- %{id: min_id} =
- activities
- |> List.first()
+ %{id: min_id} = List.first(entries)
build_pagination_fields(conn, min_id, max_id, extra_params)
build_pagination_fields(conn, min_id, max_id, extra_params)