Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicated heart emojis #2065

Merged
merged 2 commits into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion app/src/renderer/apps/Courier/components/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ import { useShipStore } from 'renderer/stores/ship.store';

import { ChatMessageType } from '../../../stores/models/chat.model';

// We unify similar Emojis across iOS and desktop (iOS taking precedence).
// This is a map of different web emojis to the iOS emoji.
const EMOJI_MAP: Record<string, string> = {
// For both desktop hearts, use the mobile heart: 2764-fe0f
'1f606': '2764-fe0f',
'2665-fe0f': '2764-fe0f',
};

type ChatMessageProps = {
message: ChatMessageType;
ourColor: string;
Expand Down Expand Up @@ -101,8 +109,11 @@ export const ChatMessagePresenter = ({

const onReaction = useCallback(
(payload: OnReactionPayload) => {
const emoji =
payload.emoji in EMOJI_MAP ? EMOJI_MAP[payload.emoji] : payload.emoji;

if (payload.action === 'add') {
selectedChat?.sendReaction(message.id, payload.emoji);
selectedChat?.sendReaction(message.id, emoji);
} else {
if (!payload.reactId) {
console.warn('No reactId', payload);
Expand Down