Message: Check if reply is allowed for swipe gesture

This commit is contained in:
Alexander Zinchuk 2021-08-27 21:08:52 +03:00
parent 3077ef8f13
commit 8edc4f90a8
2 changed files with 10 additions and 2 deletions

View File

@ -41,6 +41,7 @@ import {
selectShouldAutoPlayMedia,
selectShouldLoopStickers,
selectTheme,
selectAllowedMessageActions,
} from '../../../modules/selectors';
import {
getMessageContent,
@ -140,6 +141,7 @@ type StateProps = {
isForwarding?: boolean;
isChatWithSelf?: boolean;
isChannel?: boolean;
canReply?: boolean;
lastSyncTime?: number;
highlight?: string;
isSingleEmoji?: boolean;
@ -200,6 +202,7 @@ const Message: FC<OwnProps & StateProps & DispatchProps> = ({
isForwarding,
isChatWithSelf,
isChannel,
canReply,
lastSyncTime,
highlight,
animatedEmoji,
@ -309,6 +312,7 @@ const Message: FC<OwnProps & StateProps & DispatchProps> = ({
isLocal,
isAlbum,
Boolean(isInSelectMode),
Boolean(canReply),
onContextMenu,
handleBeforeContextMenu,
);
@ -836,6 +840,8 @@ export default memo(withGlobal<OwnProps>(
isSelected = selectIsMessageSelected(global, id);
}
const { canReply } = (messageListType === 'thread' && selectAllowedMessageActions(global, message, threadId)) || {};
return {
theme: selectTheme(global),
chatUsername,
@ -851,6 +857,7 @@ export default memo(withGlobal<OwnProps>(
isForwarding,
isChatWithSelf,
isChannel,
canReply,
lastSyncTime,
highlight,
isSingleEmoji: Boolean(singleEmoji),

View File

@ -18,6 +18,7 @@ export default function useOuterHandlers(
isLocal: boolean,
isAlbum: boolean,
isInSelectMode: boolean,
canReply: boolean,
onContextMenu: (e: React.MouseEvent) => void,
handleBeforeContextMenu: (e: React.MouseEvent) => void,
) {
@ -74,7 +75,7 @@ export default function useOuterHandlers(
}
useEffect(() => {
if (!IS_TOUCH_ENV || isInSelectMode) {
if (!IS_TOUCH_ENV || isInSelectMode || !canReply) {
return undefined;
}
@ -105,7 +106,7 @@ export default function useOuterHandlers(
startedAt = undefined;
},
});
}, [containerRef, isInSelectMode, messageId, setReplyingToId, markSwiped, unmarkSwiped]);
}, [containerRef, isInSelectMode, messageId, setReplyingToId, markSwiped, unmarkSwiped, canReply]);
return {
handleMouseDown: !isInSelectMode ? handleMouseDown : undefined,