AccountController: Build the correct update activity.
authorlain <lain@soykaf.club>
Mon, 10 Aug 2020 08:33:05 +0000 (10:33 +0200)
committerlain <lain@soykaf.club>
Mon, 10 Aug 2020 08:33:05 +0000 (10:33 +0200)
Will fix federation issues.

lib/pleroma/web/mastodon_api/controllers/account_controller.ex
test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs

index f45678184eeee58985fbddc30f3d5e9d24e38bca..95d8452df0447f08c540d2b5a8cbbb0a7b81958c 100644 (file)
@@ -226,7 +226,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
     with changeset <- User.update_changeset(user, user_params),
          {:ok, unpersisted_user} <- Ecto.Changeset.apply_action(changeset, :update),
          updated_object <-
-           Pleroma.Web.ActivityPub.UserView.render("user.json", user: user)
+           Pleroma.Web.ActivityPub.UserView.render("user.json", user: unpersisted_user)
            |> Map.delete("@context"),
          {:ok, update_data, []} <- Builder.update(user, updated_object),
          {:ok, _update, _} <-
index b888e4c7110100e8135c1ef60d403c4355e47d05..2e67047266089c1d30989fbfffc6be72c4448bbf 100644 (file)
@@ -214,6 +214,10 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
 
       assert user_data = json_response_and_validate_schema(conn, 200)
       assert user_data["display_name"] == "markorepairs"
+
+      update_activity = Repo.one(Pleroma.Activity)
+      assert update_activity.data["type"] == "Update"
+      assert update_activity.data["object"]["name"] == "markorepairs"
     end
 
     test "updates the user's avatar", %{user: user, conn: conn} do