diff --git a/native/chat/multimedia-message-tooltip-modal.react.js b/native/chat/multimedia-message-tooltip-modal.react.js
--- a/native/chat/multimedia-message-tooltip-modal.react.js
+++ b/native/chat/multimedia-message-tooltip-modal.react.js
@@ -11,7 +11,6 @@
import type { VerticalBounds } from '../types/layout-types';
import { onPressReport } from './message-report-utils';
import MultimediaMessageTooltipButton from './multimedia-message-tooltip-button.react';
-import { onPressReact } from './reaction-message-utils';
import { navigateToSidebar } from './sidebar-navigation';
export type MultimediaMessageTooltipModalParams = TooltipParams<{
@@ -26,11 +25,6 @@
text: 'Thread',
onPress: navigateToSidebar,
},
- {
- id: 'react',
- text: '👍',
- onPress: onPressReact,
- },
{
id: 'report',
text: 'Report',
diff --git a/native/chat/multimedia-message.react.js b/native/chat/multimedia-message.react.js
--- a/native/chat/multimedia-message.react.js
+++ b/native/chat/multimedia-message.react.js
@@ -10,7 +10,6 @@
import { StyleSheet, View } from 'react-native';
import { messageKey } from 'lib/shared/message-utils';
-import { useCanCreateReactionFromMessage } from 'lib/shared/reaction-utils';
import { useCanCreateSidebarFromMessage } from 'lib/shared/thread-utils';
import type { MediaInfo } from 'lib/types/media-types';
@@ -48,7 +47,6 @@
+overlayContext: ?OverlayContextType,
+chatContext: ?ChatContextType,
+canCreateSidebarFromMessage: boolean,
- +canCreateReactionFromMessage: boolean,
};
type State = {
+clickable: boolean,
@@ -94,10 +92,6 @@
result.push('sidebar');
}
- if (this.props.canCreateReactionFromMessage) {
- result.push('react');
- }
-
if (!this.props.item.messageInfo.creator.isViewer) {
result.push('report');
}
@@ -198,7 +192,6 @@
overlayContext,
chatContext,
canCreateSidebarFromMessage,
- canCreateReactionFromMessage,
...viewProps
} = this.props;
return (
@@ -240,10 +233,6 @@
props.item.threadInfo,
props.item.messageInfo,
);
- const canCreateReactionFromMessage = useCanCreateReactionFromMessage(
- props.item.threadInfo,
- props.item.messageInfo,
- );
return (
);
},
diff --git a/native/chat/reaction-message-utils.js b/native/chat/reaction-message-utils.js
--- a/native/chat/reaction-message-utils.js
+++ b/native/chat/reaction-message-utils.js
@@ -11,122 +11,15 @@
import type { MessageReactionInfo } from 'lib/selectors/chat-selectors';
import { messageTypes } from 'lib/types/message-types';
import type { RawReactionMessageInfo } from 'lib/types/messages/reaction';
-import type { BindServerCall, DispatchFunctions } from 'lib/utils/action-utils';
import {
useDispatchActionPromise,
useServerCall,
} from 'lib/utils/action-utils';
import { cloneError } from 'lib/utils/errors';
-import type { InputState } from '../input/input-state';
-import type { AppNavigationProp } from '../navigation/app-navigator.react';
-import type { MessageTooltipRouteNames } from '../navigation/route-names';
-import type { TooltipRoute } from '../navigation/tooltip.react';
import { useSelector } from '../redux/redux-utils';
import type { LayoutCoordinates, VerticalBounds } from '../types/layout-types';
import type { ViewStyle } from '../types/styles';
-import type { ChatContextType } from './chat-context';
-
-function onPressReact(
- route: TooltipRoute,
- dispatchFunctions: DispatchFunctions,
- bindServerCall: BindServerCall,
- inputState: ?InputState,
- navigation: AppNavigationProp,
- viewerID: ?string,
- chatContext: ?ChatContextType,
- reactionMessageLocalID: ?string,
-) {
- const messageID = route.params.item.messageInfo.id;
- invariant(messageID, 'messageID should be set');
-
- const threadID = route.params.item.threadInfo.id;
- invariant(threadID, 'threadID should be set');
-
- invariant(viewerID, 'viewerID should be set');
- invariant(reactionMessageLocalID, 'reactionMessageLocalID should be set');
-
- const reactionInput = '👍';
- const viewerReacted = route.params.item.reactions.get(reactionInput)
- ?.viewerReacted;
-
- const action = viewerReacted ? 'remove_reaction' : 'add_reaction';
-
- sendReaction(
- messageID,
- reactionMessageLocalID,
- threadID,
- reactionInput,
- action,
- dispatchFunctions,
- bindServerCall,
- viewerID,
- );
-}
-
-function sendReaction(
- messageID: string,
- localID: string,
- threadID: string,
- reaction: string,
- action: 'add_reaction' | 'remove_reaction',
- dispatchFunctions: DispatchFunctions,
- bindServerCall: BindServerCall,
- viewerID: string,
-) {
- const callSendReactionMessage = bindServerCall(sendReactionMessage);
-
- const reactionMessagePromise = (async () => {
- try {
- const result = await callSendReactionMessage({
- threadID,
- localID,
- targetMessageID: messageID,
- reaction,
- action,
- });
- return {
- localID,
- serverID: result.id,
- threadID,
- time: result.time,
- interface: result.interface,
- };
- } catch (e) {
- Alert.alert(
- 'Couldn’t send the reaction',
- 'Please try again later',
- [{ text: 'OK' }],
- {
- cancelable: true,
- },
- );
-
- const copy = cloneError(e);
- copy.localID = localID;
- copy.threadID = threadID;
- throw copy;
- }
- })();
-
- const startingPayload: RawReactionMessageInfo = {
- type: messageTypes.REACTION,
- threadID,
- localID,
- creatorID: viewerID,
- time: Date.now(),
- targetMessageID: messageID,
- reaction,
- action,
- };
-
- dispatchFunctions.dispatchActionPromise(
- sendReactionMessageActionTypes,
- reactionMessagePromise,
- undefined,
- startingPayload,
- );
-}
function useSendReaction(
messageID: ?string,
@@ -281,4 +174,4 @@
]);
}
-export { onPressReact, useSendReaction, useReactionSelectionPopoverPosition };
+export { useSendReaction, useReactionSelectionPopoverPosition };
diff --git a/native/chat/robotext-message-tooltip-modal.react.js b/native/chat/robotext-message-tooltip-modal.react.js
--- a/native/chat/robotext-message-tooltip-modal.react.js
+++ b/native/chat/robotext-message-tooltip-modal.react.js
@@ -8,7 +8,6 @@
type BaseTooltipProps,
} from '../navigation/tooltip.react';
import type { ChatRobotextMessageInfoItemWithHeight } from '../types/chat-types';
-import { onPressReact } from './reaction-message-utils';
import RobotextMessageTooltipButton from './robotext-message-tooltip-button.react';
import { navigateToSidebar } from './sidebar-navigation';
@@ -23,11 +22,6 @@
text: 'Thread',
onPress: navigateToSidebar,
},
- {
- id: 'react',
- text: '👍',
- onPress: onPressReact,
- },
],
};
diff --git a/native/chat/robotext-message.react.js b/native/chat/robotext-message.react.js
--- a/native/chat/robotext-message.react.js
+++ b/native/chat/robotext-message.react.js
@@ -5,7 +5,6 @@
import { View } from 'react-native';
import { messageKey } from 'lib/shared/message-utils';
-import { useCanCreateReactionFromMessage } from 'lib/shared/reaction-utils';
import { useCanCreateSidebarFromMessage } from 'lib/shared/thread-utils';
import { ChatContext } from '../chat/chat-context';
@@ -84,11 +83,6 @@
item.messageInfo,
);
- const canCreateReactionFromMessage = useCanCreateReactionFromMessage(
- item.threadInfo,
- item.messageInfo,
- );
-
const visibleEntryIDs = React.useMemo(() => {
const result = [];
@@ -96,16 +90,8 @@
result.push('sidebar');
}
- if (canCreateReactionFromMessage) {
- result.push('react');
- }
-
return result;
- }, [
- item.threadCreatedFromMessage,
- canCreateSidebarFromMessage,
- canCreateReactionFromMessage,
- ]);
+ }, [item.threadCreatedFromMessage, canCreateSidebarFromMessage]);
const openRobotextTooltipModal = React.useCallback(
(x, y, width, height, pageX, pageY) => {
diff --git a/native/chat/text-message-tooltip-modal.react.js b/native/chat/text-message-tooltip-modal.react.js
--- a/native/chat/text-message-tooltip-modal.react.js
+++ b/native/chat/text-message-tooltip-modal.react.js
@@ -17,7 +17,6 @@
} from '../navigation/tooltip.react';
import type { ChatTextMessageInfoItemWithHeight } from '../types/chat-types';
import { onPressReport } from './message-report-utils';
-import { onPressReact } from './reaction-message-utils';
import { navigateToSidebar } from './sidebar-navigation';
import TextMessageTooltipButton from './text-message-tooltip-button.react';
@@ -54,11 +53,6 @@
onPress: navigateToSidebar,
},
{ id: 'copy', text: 'Copy', onPress: onPressCopy },
- {
- id: 'react',
- text: '👍',
- onPress: onPressReact,
- },
{
id: 'report',
text: 'Report',
diff --git a/native/chat/text-message.react.js b/native/chat/text-message.react.js
--- a/native/chat/text-message.react.js
+++ b/native/chat/text-message.react.js
@@ -5,7 +5,6 @@
import { View } from 'react-native';
import { messageKey } from 'lib/shared/message-utils';
-import { useCanCreateReactionFromMessage } from 'lib/shared/reaction-utils';
import {
threadHasPermission,
useCanCreateSidebarFromMessage,
@@ -46,7 +45,6 @@
...BaseProps,
// Redux state
+canCreateSidebarFromMessage: boolean,
- +canCreateReactionFromMessage: boolean,
// withOverlayContext
+overlayContext: ?OverlayContextType,
// ChatContext
@@ -77,7 +75,6 @@
chatContext,
isLinkModalActive,
canCreateSidebarFromMessage,
- canCreateReactionFromMessage,
...viewProps
} = this.props;
@@ -147,10 +144,6 @@
result.push('sidebar');
}
- if (this.props.canCreateReactionFromMessage) {
- result.push('react');
- }
-
if (!this.props.item.messageInfo.creator.isViewer) {
result.push('report');
}
@@ -245,10 +238,6 @@
props.item.threadInfo,
props.item.messageInfo,
);
- const canCreateReactionFromMessage = useCanCreateReactionFromMessage(
- props.item.threadInfo,
- props.item.messageInfo,
- );
React.useEffect(() => clearMarkdownContextData, [clearMarkdownContextData]);
@@ -256,7 +245,6 @@
,
viewerID: ?string,
chatContext: ?ChatContextType,
- reactionMessageLocalID: ?string,
) => mixed,
};
type TooltipItemProps = {
@@ -252,26 +250,7 @@
return entries;
}
const visibleSet = new Set(visibleEntryIDs);
- const filteredEntries = entries.filter(entry => visibleSet.has(entry.id));
-
- // this is a temporary change and will be reverted once we go from
- // message liking to message reactions
- return filteredEntries.map(entry => {
- if (entry.id !== 'react') {
- return entry;
- }
-
- const messageLikes = this.props.route.params.item?.reactions.get('👍');
- let reactionEntryText = entry.text;
- if (messageLikes && messageLikes.viewerReacted) {
- reactionEntryText = 'Unlike';
- }
-
- return {
- ...entry,
- text: reactionEntryText,
- };
- });
+ return entries.filter(entry => visibleSet.has(entry.id));
}
get tooltipHeight(): number {
@@ -586,11 +565,6 @@
this.props.setHideTooltip(true);
}
- let reactionMessageLocalID;
- if (entry.id === 'react') {
- reactionMessageLocalID = `${localIDPrefix}${this.props.nextReactionMessageLocalID}`;
- }
-
const dispatchFunctions = {
dispatch: this.props.dispatch,
dispatchActionPromise: this.props.dispatchActionPromise,
@@ -603,7 +577,6 @@
this.props.navigation,
this.props.viewerID,
this.props.chatContext,
- reactionMessageLocalID,
);
};