Merge pull request '#1 TypeError: Cannot read properties of undefined (reading 'toLowerCase') [v1.10.8-15, all]' (#2) from jon/element-web-patches:master into master

Reviewed-on: #2
This commit is contained in:
q 2022-03-31 16:19:30 -04:00
commit d72f542195
6 changed files with 85 additions and 288 deletions

View File

@ -1,37 +1,46 @@
#!/bin/bash
set -euo pipefail
LWD="$PWD"
echo Backing up EmojiProvider.tsx...
# TODO: cleanup, generify backup
echo 'Backing up EmojiProvider.tsx...'
if [ ! -f ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx ]; then
cp ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider.tsx ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx
else
cp ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider.tsx
fi
echo Backing up compact.json...
echo 'Backing up compact.json...'
if [ ! -f ../node_modules/emojibase-data/en/compact_backup.json ]; then
cp ../node_modules/emojibase-data/en/compact.json ../node_modules/emojibase-data/en/compact_backup.json
else
cp ../node_modules/emojibase-data/en/compact_backup.json ../node_modules/emojibase-data/en/compact.json
fi
echo Adding custom emoji...
jq -s -c '.[0] + .[1]' "../node_modules/emojibase-data/en/compact_backup.json" "./emoji.json" > "../node_modules/emojibase-data/en/compact.json"
echo 'Adding custom emoji...'
{
cd ./reactions;
./generate.sh > "./data-injects~.json";
jq -sc '.[0] + .[1]' "../../node_modules/emojibase-data/en/compact_backup.json" "./data-injects~.json" > "../../node_modules/emojibase-data/en/compact.json";
rm "./data-injects~.json";
cd "$LWD";
} || { echo "Failed to inject reactions: Exit code $?" 1>&2; exit $?; }
echo Copying custom login background...
echo 'Copying custom login background...'
cp -f ./lake.jpg ../res/themes/element/img/backgrounds/lake.jpg
echo Copying custom config.json...
echo 'Copying custom config.json...'
cp -f ./config.json ../config.sample.json
echo Backing up _EmojiPicker.scss...
echo 'Backing up _EmojiPicker.scss...'
if [ ! -f ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss.backup ]; then
cp ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss.backup
else
cp ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss.backup ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss
fi
echo Adding custom emoji picker CSS...
echo 'Adding custom emoji picker CSS...'
echo "
.mx_EmojiPicker_item_wrapper {
text-overflow: clip;
@ -40,13 +49,13 @@ echo "
}" >> ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss
echo Adding greentext patch...
echo 'Adding greentext patch...'
patch "../node_modules/commonmark/dist/commonmark.js" ./greentext.patch
echo running component index fix...
echo 'running component index fix...'
cd ../node_modules/matrix-react-sdk
yarn reskindex
cd ../../element-web-patches
echo running kick fix...
echo 'running kick fix...'
./fix_kick.sh

View File

@ -1,276 +0,0 @@
[
{
"annotation": "based",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"based"
],
"tags": [
"based"
],
"unicode": "based"
},
{
"annotation": "cringe",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"cringe"
],
"tags": [
"cringe"
],
"unicode": "cringe"
},
{
"annotation": "yikes",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"yikes"
],
"tags": [
"yikes"
],
"unicode": "yikes"
},
{
"annotation": "cope",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"cope"
],
"tags": [
"cope"
],
"unicode": "cope"
},
{
"annotation": "Yes.",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"Yes."
],
"tags": [
"Yes."
],
"unicode": "Yes."
},
{
"annotation": "No.",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"No."
],
"tags": [
"No."
],
"unicode": "No."
},
{
"annotation": "(You)",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"(You)"
],
"tags": [
"(You)"
],
"unicode": "(You)"
},
{
"annotation": "lol",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"lol"
],
"tags": [
"lol"
],
"unicode": "lol"
},
{
"annotation": "RAPE",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"RAPE"
],
"tags": [
"RAPE"
],
"unicode": "RAPE"
},
{
"annotation": "F",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"F"
],
"tags": [
"F"
],
"unicode": "F"
},
{
"annotation": "vaggot",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"vaggot"
],
"tags": [
"vaggot"
],
"unicode": "vaggot"
},
{
"annotation": "vaxnigger",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"vaxnigger"
],
"tags": [
"vaxnigger"
],
"unicode": "vaxnigger"
},
{
"annotation": "Fag",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"Fag"
],
"tags": [
"Fag"
],
"unicode": "Fag"
},
{
"annotation": "simp",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"Fag"
],
"tags": [
"simp"
],
"unicode": "simp"
},
{
"annotation": "piss",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"piss"
],
"tags": [
"piss"
],
"unicode": "piss"
},
{
"annotation": "jelq",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"jelq"
],
"tags": [
"jelq"
],
"unicode": "jelq"
},
{
"annotation": "coom",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"coom"
],
"tags": [
"coom"
],
"unicode": "coom"
},
{
"annotation": "booba",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"booba"
],
"tags": [
"booba"
],
"unicode": "booba"
},
{
"annotation": "sinner",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"sinner"
],
"tags": [
"sinner"
],
"unicode": "sinner"
},
{
"annotation": "repent",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"repent"
],
"tags": [
"repent"
],
"unicode": "repent"
},
{
"annotation": "卐",
"group": 0,
"hexcode": "1F600",
"order": 1,
"shortcodes": [
"swastika"
],
"tags": [
"卐"
],
"unicode": "卐"
}
]

View File

@ -1,4 +1,5 @@
#!/bin/sh
# TODO: Check `set -euo pipefail` compat
# just to fix kick
sed -i -e 's/remove/holocaust/g' \
-e 's/Removes/Holocausts/g' ../node_modules/matrix-react-sdk/src/SlashCommands.tsx

View File

@ -0,0 +1,6 @@
#!/bin/sh
base="https://raw.githubusercontent.com/milesj/emojibase/master/packages/data/en"
for file in compact.raw.json data.raw.json; do
echo "$file:"
curl -sf "$base/$file" | jq '.[] | select(.hexcode == "2721")' || exit $?
done

24
reactions/generate.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
# Run fetch-latest-format.sh for the most up-to-date emojibase format. Target is raw.json
reactions="$(yq . /dev/stdin < reactions.yaml)"
jq -n --argjson reactions "$reactions" \
'[
$reactions[] | {
annotation: .emoji,
label: .emoji,
emoticon: .emoji,
hexcode: "2721",
unicode: .emoji,
shortcodes: (.tags? + [ .emoji ]),
tags: (.tags? + [ .emoji ]),
emoji: .emoji,
text: .emoji,
type: 0,
order: 0,
group: 8,
subgroup: 93,
version: 0.7
}
]'

33
reactions/reactions.yaml Normal file
View File

@ -0,0 +1,33 @@
- emoji: based
- emoji: cringe
- emoji: yikes
- emoji: cope
- emoji: seethe
- emoji: dilate
- emoji: '>'
- emoji: 't. jewish'
- emoji: 't. tard'
- emoji: '>implying'
- emoji: '>she'
- emoji: '>her'
- emoji: 'tard moment'
- emoji: 'woman moment'
- emoji: Yes.
- emoji: No.
- emoji: (You)
- emoji: lol
- emoji: RAPE
- emoji: F
- emoji: vaggot
- emoji: vaxnigger
- emoji: Fag
- emoji: simp
- emoji: piss
- emoji: jelq
- emoji: coom
- emoji: booba
- emoji: sinner
- emoji: repent
- emoji:
tags:
- swastika