Skip to content

Commit

Permalink
fix: emoji-mart update breaks native emoji fetch, use SearchIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilb committed Aug 17, 2023
1 parent d013373 commit 775ed53
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ts/session/apis/open_group_api/sogsv3/sogsV3SendReaction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbortSignal } from 'abort-controller';
import { getEmojiDataFromNative } from 'emoji-mart';
import { SearchIndex } from 'emoji-mart';
import { Data } from '../../../../data/data';
import { ConversationModel } from '../../../../models/conversation';
import { Action, OpenGroupReactionResponse, Reaction } from '../../../../types/Reaction';
Expand Down Expand Up @@ -68,9 +68,8 @@ export const sendSogsReactionOnionV4 = async (

// The SOGS endpoint supports any text input so we need to make sure we are sending a valid unicode emoji
// for an invalid input we use https://emojipedia.org/frame-with-an-x/ as a replacement since it cannot rendered as an emoji but is valid unicode
// NOTE emoji-mart v5.2.2 types for getEmojiDataFromNative are broken
// eslint-disable-next-line @typescript-eslint/await-thenable
const emoji = (await getEmojiDataFromNative(reaction.emoji)) ? reaction.emoji : '🖾';
const emoji = (await SearchIndex.search(reaction.emoji)) ? reaction.emoji : '🖾';
const endpoint = `/room/${room}/reaction/${reaction.id}/${emoji}`;
const method = reaction.action === Action.REACT ? 'PUT' : 'DELETE';
const serverPubkey = allValidRoomInfos[0].serverPublicKey;
Expand Down

0 comments on commit 775ed53

Please sign in to comment.