Fix pushing duplicate recent emoji

This commit is contained in:
Eduard Kuzmenko 2021-07-22 14:24:36 +03:00
parent a963cf9120
commit 7e0112ead6
2 changed files with 3 additions and 1 deletions

View File

@ -244,7 +244,7 @@ export default class EmojiTab implements EmoticonsTab {
const children = Array.from(this.recentItemsDiv.children) as HTMLElement[];
for(let i = 0, length = children.length; i < length; ++i) {
const el = children[i];
const _emoji = getEmojiFromElement(el);
const _emoji = RichTextProcessor.fixEmoji(getEmojiFromElement(el));
if(emoji === _emoji) {
if(i === 0) {
return;

View File

@ -10,6 +10,7 @@ import { validateInitObject } from "../../helpers/object";
import I18n from "../langPack";
import { isObject } from "../mtproto/bin_utils";
import apiManager from "../mtproto/mtprotoworker";
import RichTextProcessor from "../richtextprocessor";
import rootScope from "../rootScope";
import SearchIndex from "../searchIndex";
import stateStorage from "../stateStorage";
@ -219,6 +220,7 @@ export class AppEmojiManager {
}
public pushRecentEmoji(emoji: string) {
emoji = RichTextProcessor.fixEmoji(emoji);
this.getRecentEmojis().then(recent => {
recent.findAndSplice(e => e === emoji);
recent.unshift(emoji);