Fix posting from FE not saving object
This commit is contained in:
parent
734e30584a
commit
8d1be99036
|
@ -1,6 +1,6 @@
|
|||
defmodule ClacksWeb.FrontendController do
|
||||
use ClacksWeb, :controller
|
||||
alias Clacks.{Actor, User, Timeline, Repo, ActivityPub, Activity}
|
||||
alias Clacks.{Actor, User, Timeline, Repo, ActivityPub, Activity, Object}
|
||||
alias ClacksWeb.Router.Helpers, as: Routes
|
||||
alias ClacksWeb.Endpoint
|
||||
|
||||
|
@ -90,10 +90,12 @@ defmodule ClacksWeb.FrontendController do
|
|||
current_user = conn.assigns[:user] |> Repo.preload(:actor)
|
||||
|
||||
note = ActivityPub.note(current_user.actor.ap_id, content)
|
||||
create = ActivityPub.create(note)
|
||||
changeset = Activity.changeset_for_creating(create, true)
|
||||
note_changeset = Object.changeset_for_creating(note)
|
||||
{:ok, object} = Repo.insert(note_changeset)
|
||||
|
||||
{:ok, activity} = Repo.insert(changeset)
|
||||
create = ActivityPub.create(note)
|
||||
create_changeset = Activity.changeset_for_creating(create, true)
|
||||
{:ok, activity} = Repo.insert(create_changeset)
|
||||
|
||||
%{id: activity.id, actor_id: current_user.actor.id}
|
||||
|> Clacks.Worker.Federate.new()
|
||||
|
|
Loading…
Reference in New Issue