Fix remote emoji in subject disappearing after edits
This commit is contained in:
parent
11a6e88420
commit
04ded94a50
2 changed files with 50 additions and 1 deletions
|
@ -415,7 +415,14 @@ defmodule Pleroma.Web.CommonAPI do
|
||||||
|
|
||||||
defp make_update_data(user, orig_object, changes) do
|
defp make_update_data(user, orig_object, changes) do
|
||||||
kept_params = %{
|
kept_params = %{
|
||||||
visibility: Visibility.get_visibility(orig_object)
|
visibility: Visibility.get_visibility(orig_object),
|
||||||
|
in_reply_to_id:
|
||||||
|
with replied_id when is_binary(replied_id) <- orig_object.data["inReplyTo"],
|
||||||
|
%Activity{id: activity_id} <- Activity.get_create_by_object_ap_id(replied_id) do
|
||||||
|
activity_id
|
||||||
|
else
|
||||||
|
_ -> nil
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
params = Map.merge(changes, kept_params)
|
params = Map.merge(changes, kept_params)
|
||||||
|
|
|
@ -1605,5 +1605,47 @@ defmodule Pleroma.Web.CommonAPITest do
|
||||||
assert called(Pleroma.Web.Federator.publish(updated))
|
assert called(Pleroma.Web.Federator.publish(updated))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "editing a post that copied a remote title with remote emoji should keep that emoji" do
|
||||||
|
remote_emoji_uri = "https://remote.org/emoji.png"
|
||||||
|
|
||||||
|
note =
|
||||||
|
insert(
|
||||||
|
:note,
|
||||||
|
data: %{
|
||||||
|
"summary" => ":remoteemoji:",
|
||||||
|
"emoji" => %{
|
||||||
|
"remoteemoji" => remote_emoji_uri
|
||||||
|
},
|
||||||
|
"tag" => [
|
||||||
|
%{
|
||||||
|
"type" => "Emoji",
|
||||||
|
"name" => "remoteemoji",
|
||||||
|
"icon" => %{"url" => remote_emoji_uri}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
note_activity = insert(:note_activity, note: note)
|
||||||
|
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
|
{:ok, reply} =
|
||||||
|
CommonAPI.post(user, %{
|
||||||
|
status: "reply",
|
||||||
|
spoiler_text: ":remoteemoji:",
|
||||||
|
in_reply_to_id: note_activity.id
|
||||||
|
})
|
||||||
|
|
||||||
|
assert reply.object.data["emoji"]["remoteemoji"] == remote_emoji_uri
|
||||||
|
|
||||||
|
{:ok, edit} =
|
||||||
|
CommonAPI.update(user, reply, %{status: "reply mew mew", spoiler_text: ":remoteemoji:"})
|
||||||
|
|
||||||
|
edited_note = Pleroma.Object.normalize(edit)
|
||||||
|
|
||||||
|
assert edited_note.data["emoji"]["remoteemoji"] == remote_emoji_uri
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue