From 60bfaed368b518cd6fd24ce18aed771d84cdf71a Mon Sep 17 00:00:00 2001 From: sn0w Date: Tue, 14 Jun 2022 11:47:09 +0200 Subject: [PATCH] Allow reacting with emojis containing a number --- config/emoji.txt | 1 + .../object_validators/emoji_react_validator.ex | 2 +- priv/static/emoji/100a.png | Bin 0 -> 7623 bytes .../views/notification_view_test.exs | 6 +++--- 4 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 priv/static/emoji/100a.png diff --git a/config/emoji.txt b/config/emoji.txt index 52b714ee5..1d13437c9 100644 --- a/config/emoji.txt +++ b/config/emoji.txt @@ -1,3 +1,4 @@ firefox, /emoji/Firefox.gif, Gif,Fun blank, /emoji/blank.png, Fun dinosaur, /emoji/dino walking.gif, Gif +100a, /emoji/100a.png, Fun diff --git a/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex b/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex index 995395826..f4870f580 100644 --- a/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex @@ -13,7 +13,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.EmojiReactValidator do import Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations @primary_key false - @emoji_regex ~r/:[A-Za-z_-]+:/ + @emoji_regex ~r/:[A-Za-z0-9_-]+:/ embedded_schema do quote do diff --git a/priv/static/emoji/100a.png b/priv/static/emoji/100a.png new file mode 100644 index 0000000000000000000000000000000000000000..a608bf65005ff091b206a3f24e2b5b01c6a3d497 GIT binary patch literal 7623 zcmZX32{_c>_y5e;8B3V4G)N(0>_P}BQTCn4zGh#_QjC4y!q|zBElVgnlRf(yVVdk~ zC0nxn-}6bo=leYW;WhW%;eF3N=XKAy=iZ6bP`gh_&P)yhfhd)g?rH%o3V<&u0q`!j zUKR#4q~?}7DnQEs0Q4v}ItXaUG*oo%ou8j?JKY3&X7+U`paFYoscD1cR;F!$4ztbQ zrvUNqka*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Seh_b5@P6_eaJ_8!wS) z%L8ZjG*~+ySdgXrdE%{`u+1OJVk);ogtn)k-M`L{!qU<4?4aEYe`t+hRXHDmFK*Ds z(LZ82Gj;#XeYvyeymH_g@2n!rK?IgcFV;ddq_Gol?6)M80#j4F7b^t*E=8J%Q7YM%qql1o)S=DDt5bu432G9h@j~yY7)4n+a literal 0 HcmV?d00001 diff --git a/test/pleroma/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs index 00e90239e..31744a59d 100644 --- a/test/pleroma/web/mastodon_api/views/notification_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/notification_view_test.exs @@ -202,7 +202,7 @@ test "EmojiReact notification with custom emoji" do other_user = insert(:user) {:ok, activity} = CommonAPI.post(user, %{status: "#morb"}) - {:ok, _activity} = CommonAPI.react_with_emoji(activity.id, other_user, ":dinosaur:") + {:ok, _activity} = CommonAPI.react_with_emoji(activity.id, other_user, ":100a:") activity = Repo.get(Activity, activity.id) @@ -214,8 +214,8 @@ test "EmojiReact notification with custom emoji" do id: to_string(notification.id), pleroma: %{is_seen: false, is_muted: false}, type: "pleroma:emoji_reaction", - emoji: ":dinosaur:", - emoji_url: "http://localhost:4001/emoji/dino walking.gif", + emoji: ":100a:", + emoji_url: "http://localhost:4001/emoji/100a.png", account: AccountView.render("show.json", %{user: other_user, for: user}), status: StatusView.render("show.json", %{activity: activity, for: user}), created_at: Utils.to_masto_date(notification.inserted_at)