Merge pull request #2432 from oxen-io/clearnet

Merge clearing own reaction from modal closes it
pull/2494/head
Audric Ackermann 3 years ago committed by GitHub
commit 2f3bc70d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,6 +30,7 @@ type Props = {
dataTestId?: string; dataTestId?: string;
enableReactions: boolean; enableReactions: boolean;
}; };
// tslint:disable: use-simple-attributes
const StyledMessageContentContainer = styled.div<{ direction: 'left' | 'right' }>` const StyledMessageContentContainer = styled.div<{ direction: 'left' | 'right' }>`
display: flex; display: flex;
@ -66,18 +67,20 @@ export const MessageContentWithStatuses = (props: Props) => {
const currentSelection = window.getSelection(); const currentSelection = window.getSelection();
const currentSelectionString = currentSelection?.toString() || undefined; const currentSelectionString = currentSelection?.toString() || undefined;
// if multiple word are selected, consider that this double click was actually NOT used to reply to if ((e.target as any).localName !== 'em-emoji-picker') {
// but to select
if ( if (
!currentSelectionString || !currentSelectionString ||
currentSelectionString.length === 0 || currentSelectionString.length === 0 ||
!currentSelectionString.includes(' ') !/\s/.test(currentSelectionString)
) { ) {
// if multiple word are selected, consider that this double click was actually NOT used to reply to
// but to select
void replyToMessage(messageId); void replyToMessage(messageId);
currentSelection?.empty(); currentSelection?.empty();
e.preventDefault(); e.preventDefault();
return; return;
} }
}
}; };
const { messageId, ctxMenuID, isDetailView, dataTestId, enableReactions } = props; const { messageId, ctxMenuID, isDetailView, dataTestId, enableReactions } = props;

@ -111,6 +111,10 @@ const ReactionSenders = (props: ReactionSendersProps) => {
const handleRemoveReaction = async () => { const handleRemoveReaction = async () => {
await sendMessageReaction(messageId, currentReact); await sendMessageReaction(messageId, currentReact);
if (senders.length <= 1) {
dispatch(updateReactListModal(null));
}
}; };
return ( return (

Loading…
Cancel
Save