Fix activitypub.ex
This commit is contained in:
parent
1b4034dac6
commit
d8e66d0dcb
3 changed files with 33 additions and 39 deletions
|
@ -3,12 +3,9 @@ defmodule NullaWeb.NoteController do
|
|||
alias Nulla.Repo
|
||||
alias Nulla.ActivityPub
|
||||
alias Nulla.Models.Note
|
||||
alias Nulla.Models.InstanceSettings
|
||||
|
||||
def show(conn, %{"username" => username, "id" => id}) do
|
||||
accept = List.first(get_req_header(conn, "accept"))
|
||||
instance_settings = InstanceSettings.get_instance_settings!()
|
||||
domain = instance_settings.domain
|
||||
note = Note.get_note!(id) |> Repo.preload([:user, :media_attachments])
|
||||
|
||||
if username != note.user.username do
|
||||
|
@ -21,9 +18,9 @@ defmodule NullaWeb.NoteController do
|
|||
if accept in ["application/activity+json", "application/ld+json"] do
|
||||
conn
|
||||
|> put_resp_content_type("application/activity+json")
|
||||
|> json(ActivityPub.note(domain, note))
|
||||
|> json(ActivityPub.note(note))
|
||||
else
|
||||
render(conn, :show, domain: domain, note: note, layout: false)
|
||||
render(conn, :show, note: note, layout: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue