Fix pushing duplicate recent emoji
This commit is contained in:
parent
a963cf9120
commit
7e0112ead6
@ -244,7 +244,7 @@ export default class EmojiTab implements EmoticonsTab {
|
|||||||
const children = Array.from(this.recentItemsDiv.children) as HTMLElement[];
|
const children = Array.from(this.recentItemsDiv.children) as HTMLElement[];
|
||||||
for(let i = 0, length = children.length; i < length; ++i) {
|
for(let i = 0, length = children.length; i < length; ++i) {
|
||||||
const el = children[i];
|
const el = children[i];
|
||||||
const _emoji = getEmojiFromElement(el);
|
const _emoji = RichTextProcessor.fixEmoji(getEmojiFromElement(el));
|
||||||
if(emoji === _emoji) {
|
if(emoji === _emoji) {
|
||||||
if(i === 0) {
|
if(i === 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -10,6 +10,7 @@ import { validateInitObject } from "../../helpers/object";
|
|||||||
import I18n from "../langPack";
|
import I18n from "../langPack";
|
||||||
import { isObject } from "../mtproto/bin_utils";
|
import { isObject } from "../mtproto/bin_utils";
|
||||||
import apiManager from "../mtproto/mtprotoworker";
|
import apiManager from "../mtproto/mtprotoworker";
|
||||||
|
import RichTextProcessor from "../richtextprocessor";
|
||||||
import rootScope from "../rootScope";
|
import rootScope from "../rootScope";
|
||||||
import SearchIndex from "../searchIndex";
|
import SearchIndex from "../searchIndex";
|
||||||
import stateStorage from "../stateStorage";
|
import stateStorage from "../stateStorage";
|
||||||
@ -219,6 +220,7 @@ export class AppEmojiManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public pushRecentEmoji(emoji: string) {
|
public pushRecentEmoji(emoji: string) {
|
||||||
|
emoji = RichTextProcessor.fixEmoji(emoji);
|
||||||
this.getRecentEmojis().then(recent => {
|
this.getRecentEmojis().then(recent => {
|
||||||
recent.findAndSplice(e => e === emoji);
|
recent.findAndSplice(e => e === emoji);
|
||||||
recent.unshift(emoji);
|
recent.unshift(emoji);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user