Merge branch '2038-old-update-info' into 'develop'

AccountController: Build the correct update activity.

Closes #2038

See merge request pleroma/pleroma!2867
This commit is contained in:
rinpatch 2020-08-10 09:04:16 +00:00
commit 21dfcafeb1
2 changed files with 5 additions and 1 deletions

View File

@ -226,7 +226,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
with changeset <- User.update_changeset(user, user_params), with changeset <- User.update_changeset(user, user_params),
{:ok, unpersisted_user} <- Ecto.Changeset.apply_action(changeset, :update), {:ok, unpersisted_user} <- Ecto.Changeset.apply_action(changeset, :update),
updated_object <- updated_object <-
Pleroma.Web.ActivityPub.UserView.render("user.json", user: user) Pleroma.Web.ActivityPub.UserView.render("user.json", user: unpersisted_user)
|> Map.delete("@context"), |> Map.delete("@context"),
{:ok, update_data, []} <- Builder.update(user, updated_object), {:ok, update_data, []} <- Builder.update(user, updated_object),
{:ok, _update, _} <- {:ok, _update, _} <-

View 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 = json_response_and_validate_schema(conn, 200)
assert user_data["display_name"] == "markorepairs" 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 end
test "updates the user's avatar", %{user: user, conn: conn} do test "updates the user's avatar", %{user: user, conn: conn} do