Message: Check if reply is allowed for swipe gesture
This commit is contained in:
parent
3077ef8f13
commit
8edc4f90a8
@ -41,6 +41,7 @@ import {
|
|||||||
selectShouldAutoPlayMedia,
|
selectShouldAutoPlayMedia,
|
||||||
selectShouldLoopStickers,
|
selectShouldLoopStickers,
|
||||||
selectTheme,
|
selectTheme,
|
||||||
|
selectAllowedMessageActions,
|
||||||
} from '../../../modules/selectors';
|
} from '../../../modules/selectors';
|
||||||
import {
|
import {
|
||||||
getMessageContent,
|
getMessageContent,
|
||||||
@ -140,6 +141,7 @@ type StateProps = {
|
|||||||
isForwarding?: boolean;
|
isForwarding?: boolean;
|
||||||
isChatWithSelf?: boolean;
|
isChatWithSelf?: boolean;
|
||||||
isChannel?: boolean;
|
isChannel?: boolean;
|
||||||
|
canReply?: boolean;
|
||||||
lastSyncTime?: number;
|
lastSyncTime?: number;
|
||||||
highlight?: string;
|
highlight?: string;
|
||||||
isSingleEmoji?: boolean;
|
isSingleEmoji?: boolean;
|
||||||
@ -200,6 +202,7 @@ const Message: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
isForwarding,
|
isForwarding,
|
||||||
isChatWithSelf,
|
isChatWithSelf,
|
||||||
isChannel,
|
isChannel,
|
||||||
|
canReply,
|
||||||
lastSyncTime,
|
lastSyncTime,
|
||||||
highlight,
|
highlight,
|
||||||
animatedEmoji,
|
animatedEmoji,
|
||||||
@ -309,6 +312,7 @@ const Message: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
isLocal,
|
isLocal,
|
||||||
isAlbum,
|
isAlbum,
|
||||||
Boolean(isInSelectMode),
|
Boolean(isInSelectMode),
|
||||||
|
Boolean(canReply),
|
||||||
onContextMenu,
|
onContextMenu,
|
||||||
handleBeforeContextMenu,
|
handleBeforeContextMenu,
|
||||||
);
|
);
|
||||||
@ -836,6 +840,8 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
isSelected = selectIsMessageSelected(global, id);
|
isSelected = selectIsMessageSelected(global, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { canReply } = (messageListType === 'thread' && selectAllowedMessageActions(global, message, threadId)) || {};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
theme: selectTheme(global),
|
theme: selectTheme(global),
|
||||||
chatUsername,
|
chatUsername,
|
||||||
@ -851,6 +857,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
isForwarding,
|
isForwarding,
|
||||||
isChatWithSelf,
|
isChatWithSelf,
|
||||||
isChannel,
|
isChannel,
|
||||||
|
canReply,
|
||||||
lastSyncTime,
|
lastSyncTime,
|
||||||
highlight,
|
highlight,
|
||||||
isSingleEmoji: Boolean(singleEmoji),
|
isSingleEmoji: Boolean(singleEmoji),
|
||||||
|
|||||||
@ -18,6 +18,7 @@ export default function useOuterHandlers(
|
|||||||
isLocal: boolean,
|
isLocal: boolean,
|
||||||
isAlbum: boolean,
|
isAlbum: boolean,
|
||||||
isInSelectMode: boolean,
|
isInSelectMode: boolean,
|
||||||
|
canReply: boolean,
|
||||||
onContextMenu: (e: React.MouseEvent) => void,
|
onContextMenu: (e: React.MouseEvent) => void,
|
||||||
handleBeforeContextMenu: (e: React.MouseEvent) => void,
|
handleBeforeContextMenu: (e: React.MouseEvent) => void,
|
||||||
) {
|
) {
|
||||||
@ -74,7 +75,7 @@ export default function useOuterHandlers(
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!IS_TOUCH_ENV || isInSelectMode) {
|
if (!IS_TOUCH_ENV || isInSelectMode || !canReply) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +106,7 @@ export default function useOuterHandlers(
|
|||||||
startedAt = undefined;
|
startedAt = undefined;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [containerRef, isInSelectMode, messageId, setReplyingToId, markSwiped, unmarkSwiped]);
|
}, [containerRef, isInSelectMode, messageId, setReplyingToId, markSwiped, unmarkSwiped, canReply]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
handleMouseDown: !isInSelectMode ? handleMouseDown : undefined,
|
handleMouseDown: !isInSelectMode ? handleMouseDown : undefined,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user