Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fluffy-dryers-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Prevent `Export Messages` tab from closing when selecting messages by clicking outside of it and preference "Hide Contextual Bar by clicking outside of it" is set true.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { FormEvent } from 'react';
import { createContext, useCallback, useContext, useEffect, useSyncExternalStore } from 'react';

import { selectedMessageStore } from '../../providers/SelectedMessagesProvider';
Expand Down Expand Up @@ -48,11 +49,16 @@ export const useIsSelecting = (): boolean => {
return useSyncExternalStore(subscribe, getSnapshot);
};

export const useToggleSelect = (mid: string): (() => void) => {
export const useToggleSelect = (mid: string): ((event?: FormEvent<HTMLElement>) => void) => {
const { selectedMessageStore } = useContext(SelectedMessageContext);
return useCallback(() => {
selectedMessageStore.toggle(mid);
}, [mid, selectedMessageStore]);

return useCallback(
(event) => {
event?.stopPropagation();
selectedMessageStore.toggle(mid);
},
[mid, selectedMessageStore],
);
};

export const useToggleSelectAll = (): (() => void) => {
Expand Down
4 changes: 1 addition & 3 deletions apps/meteor/tests/e2e/export-messages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ test.describe('export-messages', () => {
await expect(exportMessagesTab.sendButton).toBeEnabled();
});

// TODO: Fix this test - the test is failing because when selecting the message, the import messages tab becomes not visible
// and the message is not selected.
test.fail('should be able to select a single message to export with hide contextual bar preference enabled', async ({ page, api }) => {
test('should be able to select a single message to export with hide contextual bar preference enabled', async ({ page, api }) => {
await api.post('/users.setPreferences', {
userId: 'rocketchat.internal.admin.test',
data: { hideFlexTab: true },
Expand Down
Loading