Browse Source

Fix pushing duplicate recent emoji

master
Eduard Kuzmenko 3 years ago
parent
commit
7e0112ead6
  1. 2
      src/components/emoticonsDropdown/tabs/emoji.ts
  2. 2
      src/lib/appManagers/appEmojiManager.ts

2
src/components/emoticonsDropdown/tabs/emoji.ts

@ -244,7 +244,7 @@ export default class EmojiTab implements EmoticonsTab { @@ -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;

2
src/lib/appManagers/appEmojiManager.ts

@ -10,6 +10,7 @@ import { validateInitObject } from "../../helpers/object"; @@ -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 { @@ -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);

Loading…
Cancel
Save