Chat: Open forum panel on click (#2272)
This commit is contained in:
parent
3643a3fe6d
commit
e2f111fa72
@ -126,6 +126,7 @@ const Chat: FC<OwnProps & StateProps> = ({
|
||||
openChat,
|
||||
focusLastMessage,
|
||||
loadTopics,
|
||||
openForumPanel,
|
||||
} = getActions();
|
||||
|
||||
const [isDeleteModalOpen, openDeleteModal, closeDeleteModal] = useFlag();
|
||||
@ -155,12 +156,17 @@ const Chat: FC<OwnProps & StateProps> = ({
|
||||
});
|
||||
|
||||
const handleClick = useCallback(() => {
|
||||
if (isForum) {
|
||||
openForumPanel({ chatId });
|
||||
return;
|
||||
}
|
||||
|
||||
openChat({ id: chatId, shouldReplaceHistory: true }, { forceOnHeavyAnimation: true });
|
||||
|
||||
if (isSelected && canScrollDown) {
|
||||
focusLastMessage();
|
||||
}
|
||||
}, [openChat, chatId, isSelected, canScrollDown, focusLastMessage]);
|
||||
}, [isForum, openChat, chatId, isSelected, canScrollDown, openForumPanel, focusLastMessage]);
|
||||
|
||||
const handleDragEnter = useCallback((e) => {
|
||||
e.preventDefault();
|
||||
|
||||
@ -5,13 +5,13 @@ import { MAIN_THREAD_ID } from '../../../api/types';
|
||||
import {
|
||||
exitMessageSelectMode, replaceThreadParam, updateCurrentMessageList,
|
||||
} from '../../reducers';
|
||||
import { selectChat, selectCurrentMessageList } from '../../selectors';
|
||||
import { selectCurrentMessageList } from '../../selectors';
|
||||
import { closeLocalTextSearch } from './localSearch';
|
||||
|
||||
addActionHandler('openChat', (global, actions, payload) => {
|
||||
const {
|
||||
id,
|
||||
threadId,
|
||||
threadId = MAIN_THREAD_ID,
|
||||
type = 'thread',
|
||||
shouldReplaceHistory = false,
|
||||
} = payload;
|
||||
@ -35,7 +35,7 @@ addActionHandler('openChat', (global, actions, payload) => {
|
||||
|| currentMessageList.type !== type
|
||||
)) {
|
||||
if (id) {
|
||||
global = replaceThreadParam(global, id, threadId || MAIN_THREAD_ID, 'replyStack', []);
|
||||
global = replaceThreadParam(global, id, threadId, 'replyStack', []);
|
||||
}
|
||||
|
||||
global = exitMessageSelectMode(global);
|
||||
@ -58,12 +58,6 @@ addActionHandler('openChat', (global, actions, payload) => {
|
||||
actions.closeForumPanel();
|
||||
}
|
||||
|
||||
if (id && !threadId) {
|
||||
const chat = selectChat(global, id);
|
||||
// Prevent chat opening on forum click
|
||||
if (chat?.isForum) return global;
|
||||
}
|
||||
|
||||
return updateCurrentMessageList(global, id, threadId, type, shouldReplaceHistory);
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user