Merge pull request 'Allow reacting with emojis containing a number' (#6) from sn0w/akkoma:patch/broaden-emoji-name-scope into develop

Reviewed-on: http://akkoma.dev/AkkomaGang/akkoma/pulls/6
This commit is contained in:
floatingghost 2022-06-14 10:03:49 +00:00
commit 0333dc2c2f
4 changed files with 5 additions and 4 deletions

View file

@ -1,3 +1,4 @@
firefox, /emoji/Firefox.gif, Gif,Fun firefox, /emoji/Firefox.gif, Gif,Fun
blank, /emoji/blank.png, Fun blank, /emoji/blank.png, Fun
dinosaur, /emoji/dino walking.gif, Gif dinosaur, /emoji/dino walking.gif, Gif
100a, /emoji/100a.png, Fun

View file

@ -13,7 +13,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.EmojiReactValidator do
import Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations import Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations
@primary_key false @primary_key false
@emoji_regex ~r/:[A-Za-z_-]+:/ @emoji_regex ~r/:[A-Za-z0-9_-]+:/
embedded_schema do embedded_schema do
quote do quote do

BIN
priv/static/emoji/100a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View file

@ -202,7 +202,7 @@ test "EmojiReact notification with custom emoji" do
other_user = insert(:user) other_user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{status: "#morb"}) {: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) activity = Repo.get(Activity, activity.id)
@ -214,8 +214,8 @@ test "EmojiReact notification with custom emoji" do
id: to_string(notification.id), id: to_string(notification.id),
pleroma: %{is_seen: false, is_muted: false}, pleroma: %{is_seen: false, is_muted: false},
type: "pleroma:emoji_reaction", type: "pleroma:emoji_reaction",
emoji: ":dinosaur:", emoji: ":100a:",
emoji_url: "http://localhost:4001/emoji/dino walking.gif", emoji_url: "http://localhost:4001/emoji/100a.png",
account: AccountView.render("show.json", %{user: other_user, for: user}), account: AccountView.render("show.json", %{user: other_user, for: user}),
status: StatusView.render("show.json", %{activity: activity, for: user}), status: StatusView.render("show.json", %{activity: activity, for: user}),
created_at: Utils.to_masto_date(notification.inserted_at) created_at: Utils.to_masto_date(notification.inserted_at)