Copy emoji in the subject from parent post
Sometimes people put emoji in the subject, which results in the subject looking broken if someone replies to it from a server that does not have the said emoji under the same shortcode. This patch solves the problem by extending the emoji set available in the summary to that of the parent post.
This commit is contained in:
parent
572363793f
commit
d3660b24d3
4 changed files with 111 additions and 0 deletions
|
|
@ -25,6 +25,11 @@ defmodule Pleroma.Web.CommonAPITest do
|
|||
|
||||
require Pleroma.Constants
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
end
|
||||
|
||||
setup do: clear_config([:instance, :safe_dm_mentions])
|
||||
setup do: clear_config([:instance, :limit])
|
||||
setup do: clear_config([:instance, :max_pinned_statuses])
|
||||
|
|
@ -517,6 +522,27 @@ defmodule Pleroma.Web.CommonAPITest do
|
|||
assert url == "#{Pleroma.Web.base_url()}/emoji/blank.png"
|
||||
end
|
||||
|
||||
test "it copies emoji from the subject of the parent post" do
|
||||
%Object{} =
|
||||
object =
|
||||
Object.normalize("https://patch.cx/objects/a399c28e-c821-4820-bc3e-4afeb044c16f",
|
||||
fetch: true
|
||||
)
|
||||
|
||||
activity = Activity.get_create_by_object_ap_id(object.data["id"])
|
||||
user = insert(:user)
|
||||
|
||||
{:ok, reply_activity} =
|
||||
CommonAPI.post(user, %{
|
||||
in_reply_to_id: activity.id,
|
||||
status: ":joker_disapprove:",
|
||||
spoiler_text: ":joker_smile:"
|
||||
})
|
||||
|
||||
assert Object.normalize(reply_activity).data["emoji"][":joker_smile:"]
|
||||
refute Object.normalize(reply_activity).data["emoji"][":joker_disapprove:"]
|
||||
end
|
||||
|
||||
test "deactivated users can't post" do
|
||||
user = insert(:user, is_active: false)
|
||||
assert {:error, _} = CommonAPI.post(user, %{status: "ye"})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue