Update tests
This commit is contained in:
parent
406cd1798c
commit
c30541830f
10 changed files with 134 additions and 284 deletions
|
@ -6,7 +6,7 @@ defmodule NullaWeb.ActorController do
|
|||
alias Nulla.Models.InstanceSettings
|
||||
|
||||
def show(conn, %{"username" => username}) do
|
||||
accept = List.first(get_req_header(conn, "accept"))
|
||||
format = Phoenix.Controller.get_format(conn)
|
||||
instance_settings = InstanceSettings.get_instance_settings!()
|
||||
domain = instance_settings.domain
|
||||
|
||||
|
@ -17,7 +17,7 @@ defmodule NullaWeb.ActorController do
|
|||
|> json(%{error: "Not Found"})
|
||||
|
||||
%Actor{} = actor ->
|
||||
if accept in ["application/activity+json"] do
|
||||
if format == "activity+json" do
|
||||
conn
|
||||
|> put_resp_content_type("application/activity+json")
|
||||
|> send_resp(200, Jason.encode!(ActivityPub.actor(actor)))
|
||||
|
|
|
@ -7,7 +7,7 @@ defmodule NullaWeb.NoteController do
|
|||
def show(conn, %{"username" => username, "id" => id}) do
|
||||
case Integer.parse(id) do
|
||||
{int_id, ""} ->
|
||||
note = Note.get_note(int_id) |> Repo.preload([:actor, :media_attachments])
|
||||
note = Note.get_note(id: int_id) |> Repo.preload([:actor, :media_attachments])
|
||||
|
||||
cond do
|
||||
is_nil(note) ->
|
||||
|
@ -23,9 +23,9 @@ defmodule NullaWeb.NoteController do
|
|||
|> halt()
|
||||
|
||||
true ->
|
||||
accept = List.first(get_req_header(conn, "accept"))
|
||||
format = Phoenix.Controller.get_format(conn)
|
||||
|
||||
if accept in ["application/activity+json", "application/ld+json"] do
|
||||
if format == "activity+json" do
|
||||
conn
|
||||
|> put_resp_content_type("application/activity+json")
|
||||
|> json(ActivityPub.note(note))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue