Browse Source

Fix posting from FE not saving object

master
Shadowfacts 1 year ago
parent
commit
8d1be99036
Signed by: shadowfacts GPG Key ID: 94A5AB95422746E5
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      lib/clacks_web/controllers/frontend_controller.ex

+ 6
- 4
lib/clacks_web/controllers/frontend_controller.ex View File

@ -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…
Cancel
Save