pl-fe: Remove fix for custom emojis

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-10-16 20:22:39 +02:00
parent 1f4d879296
commit a70add24af
2 changed files with 2 additions and 21 deletions

View file

@ -132,7 +132,6 @@
"reselect": "^5.1.1",
"resize-observer-polyfill": "^1.5.1",
"sass": "^1.79.4",
"semver": "^7.6.3",
"stringz": "^2.1.0",
"tiny-queue": "^0.2.1",
"tslib": "^2.7.0",

View file

@ -1,5 +1,4 @@
import { buildCustomEmojis } from 'pl-fe/features/emoji';
import emojiData from 'pl-fe/features/emoji/data';
import { addCustomToPool } from 'pl-fe/features/emoji/search';
import { CUSTOM_EMOJIS_FETCH_SUCCESS, type CustomEmojisAction } from '../actions/custom-emojis';
@ -8,27 +7,10 @@ import type { CustomEmoji } from 'pl-api';
const initialState: Array<CustomEmoji> = [];
// Populate custom emojis for composer autosuggest
const autosuggestPopulate = (emojis: Array<CustomEmoji>) => {
addCustomToPool(buildCustomEmojis(emojis));
};
const importEmojis = (customEmojis: Array<CustomEmoji>) => {
const emojis = customEmojis.filter((emoji) => {
// If a custom emoji has the shortcode of a Unicode emoji, skip it.
// Otherwise it breaks EmojiMart.
// https://gitlab.com/soapbox-pub/soapbox/-/issues/610
const shortcode = emoji.shortcode.toLowerCase();
return !emojiData.emojis[shortcode];
});
autosuggestPopulate(emojis);
return emojis;
};
const custom_emojis = (state = initialState, action: CustomEmojisAction) => {
if (action.type === CUSTOM_EMOJIS_FETCH_SUCCESS) {
return importEmojis(action.custom_emojis);
addCustomToPool(buildCustomEmojis(action.custom_emojis));
return action.custom_emojis;
}
return state;