Skip to content

Commit

Permalink
Merge branch 'develop' into feat/add-contact-identification-stats
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusbsilva137 authored Dec 19, 2024
2 parents 96aeba0 + 76f6239 commit 8ba58ce
Show file tree
Hide file tree
Showing 55 changed files with 811 additions and 452 deletions.
22 changes: 22 additions & 0 deletions .changeset/blue-items-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@rocket.chat/fuselage-ui-kit': patch
'@rocket.chat/instance-status': patch
'@rocket.chat/ui-theming': patch
'@rocket.chat/model-typings': patch
'@rocket.chat/ui-video-conf': patch
'@rocket.chat/uikit-playground': patch
'@rocket.chat/core-typings': patch
'@rocket.chat/rest-typings': patch
'@rocket.chat/apps-engine': patch
'@rocket.chat/ui-composer': patch
'@rocket.chat/ui-contexts': patch
'@rocket.chat/gazzodown': patch
'@rocket.chat/ui-avatar': patch
'@rocket.chat/ui-client': patch
'@rocket.chat/livechat': patch
'@rocket.chat/ui-voip': patch
'@rocket.chat/i18n': patch
'@rocket.chat/meteor': patch
---

Fixes an error where the engine would not retry a subprocess restart if the last attempt failed
22 changes: 22 additions & 0 deletions .changeset/gold-comics-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@rocket.chat/fuselage-ui-kit': patch
'@rocket.chat/instance-status': patch
'@rocket.chat/ui-theming': patch
'@rocket.chat/model-typings': patch
'@rocket.chat/ui-video-conf': patch
'@rocket.chat/uikit-playground': patch
'@rocket.chat/core-typings': patch
'@rocket.chat/rest-typings': patch
'@rocket.chat/apps-engine': patch
'@rocket.chat/ui-composer': patch
'@rocket.chat/ui-contexts': patch
'@rocket.chat/gazzodown': patch
'@rocket.chat/ui-avatar': patch
'@rocket.chat/ui-client': patch
'@rocket.chat/livechat': patch
'@rocket.chat/ui-voip': patch
'@rocket.chat/i18n': patch
'@rocket.chat/meteor': patch
---

Fixes error propagation when trying to get the status of apps in some cases
5 changes: 5 additions & 0 deletions .changeset/lucky-wolves-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes a UI issue that showed the incorrect migration number on the `Information` page. This was caused by a function calculating the stats before the server had migrated the database and updated the control.
5 changes: 5 additions & 0 deletions .changeset/new-mails-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/livechat": patch
---

Fixes issue that caused different sessions when opening a livechat popover in cross domain
22 changes: 22 additions & 0 deletions .changeset/proud-planets-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@rocket.chat/fuselage-ui-kit': patch
'@rocket.chat/instance-status': patch
'@rocket.chat/ui-theming': patch
'@rocket.chat/model-typings': patch
'@rocket.chat/ui-video-conf': patch
'@rocket.chat/uikit-playground': patch
'@rocket.chat/core-typings': patch
'@rocket.chat/rest-typings': patch
'@rocket.chat/apps-engine': patch
'@rocket.chat/ui-composer': patch
'@rocket.chat/ui-contexts': patch
'@rocket.chat/gazzodown': patch
'@rocket.chat/ui-avatar': patch
'@rocket.chat/ui-client': patch
'@rocket.chat/livechat': patch
'@rocket.chat/ui-voip': patch
'@rocket.chat/i18n': patch
'@rocket.chat/meteor': patch
---

Fixes wrong data being reported to total failed apps metrics and statistics
7 changes: 7 additions & 0 deletions .changeset/shaggy-bulldogs-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@rocket.chat/ui-composer': minor
'@rocket.chat/i18n': minor
'@rocket.chat/meteor': minor
---

Introduces a new option when exporting messages, allowing users to select and download a JSON file directly from client
8 changes: 3 additions & 5 deletions apps/meteor/app/statistics/server/lib/getAppsStatistics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async function _getAppsStatistics(): Promise<AppsStatistics> {
totalInstalled++;

const status = await app.getStatus();
const storageItem = await app.getStorageItem();
const storageItem = app.getStorageItem();

if (storageItem.installationSource === AppInstallationSource.PRIVATE) {
totalPrivateApps++;
Expand All @@ -51,12 +51,10 @@ async function _getAppsStatistics(): Promise<AppsStatistics> {
}
}

if (status === AppStatus.MANUALLY_DISABLED) {
totalFailed++;
}

if (AppStatusUtils.isEnabled(status)) {
totalActive++;
} else if (status !== AppStatus.MANUALLY_DISABLED) {
totalFailed++;
}
}),
);
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/ui/client/lib/ChatMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ChatMessages implements ChatAPI {

public composer: ComposerAPI | undefined;

public setComposerAPI = (composer: ComposerAPI): void => {
public setComposerAPI = (composer?: ComposerAPI): void => {
this.composer?.release();
this.composer = composer;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const RoomMessage = ({
ref={messageRef}
id={message._id}
role='listitem'
aria-roledescription={sequential ? t('sequential_message') : t('message')}
aria-roledescription={t('message')}
tabIndex={0}
aria-labelledby={`${message._id}-displayName ${message._id}-time ${message._id}-content ${message._id}-read-status`}
onClick={selecting ? toggleSelected : undefined}
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/lib/chats/ChatAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export type UploadsAPI = {
export type ChatAPI = {
readonly uid: string | null;
readonly composer?: ComposerAPI;
readonly setComposerAPI: (composer: ComposerAPI) => void;
readonly setComposerAPI: (composer?: ComposerAPI) => void;
readonly data: DataAPI;
readonly uploads: UploadsAPI;
readonly readStateManager: ReadStateManager;
Expand Down
21 changes: 7 additions & 14 deletions apps/meteor/client/providers/OmnichannelProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const OmnichannelProvider = ({ children }: OmnichannelProviderProps) => {
OmnichannelSortingMechanismSettingType.Timestamp,
);

const lastQueueSize = useRef(0);

const loggerRef = useRef(new ClientLogger('OmnichannelProvider'));
const hasAccess = usePermission('view-l-room');
const canViewOmnichannelQueue = usePermission('view-livechat-queue');
Expand Down Expand Up @@ -151,20 +153,11 @@ const OmnichannelProvider = ({ children }: OmnichannelProviderProps) => {
);

useEffect(() => {
const observer = LivechatInquiry.find(
{ status: LivechatInquiryStatus.QUEUED },
{
sort: getOmniChatSortQuery(omnichannelSortingMechanism),
limit: omnichannelPoolMaxIncoming,
},
).observe({
added: (_inquiry) => {
KonchatNotification.newRoom();
},
});

return () => observer.stop();
}, [omnichannelPoolMaxIncoming, omnichannelSortingMechanism]);
if (lastQueueSize.current < (queue?.length ?? 0)) {
KonchatNotification.newRoom();
}
lastQueueSize.current = queue?.length ?? 0;
}, [queue?.length]);

useOmnichannelContinuousSoundNotification(queue ?? []);

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/views/room/Header/icons/Encrypted.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { HeaderState } from '../../../../components/Header';
const Encrypted = ({ room }: { room: IRoom }) => {
const { t } = useTranslation();
const e2eEnabled = useSetting('E2E_Enable');
return e2eEnabled && room?.encrypted ? <HeaderState title={t('Encrypted')} icon='key' color={colors.g500} tiny /> : null;
return e2eEnabled && room?.encrypted ? <HeaderState title={t('Encrypted')} icon='key' color={colors.g500} /> : null;
};

export default memo(Encrypted);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext, useCallback, useContext } from 'react';
import { createContext, useCallback, useContext, useEffect } from 'react';
import { useSyncExternalStore } from 'use-sync-external-store/shim';

import { selectedMessageStore } from '../../providers/SelectedMessagesProvider';
Expand All @@ -21,7 +21,19 @@ export const useIsSelectedMessage = (mid: string): boolean => {

const getSnapshot = (): boolean => selectedMessageStore.isSelected(mid);

return useSyncExternalStore(subscribe, getSnapshot);
const isSelected = useSyncExternalStore(subscribe, getSnapshot);

useEffect(() => {
if (isSelected) {
return;
}

selectedMessageStore.addAvailableMessage(mid);

return () => selectedMessageStore.removeAvailableMessage(mid);
}, [mid, selectedMessageStore, isSelected]);

return isSelected;
};

export const useIsSelecting = (): boolean => {
Expand All @@ -44,6 +56,20 @@ export const useToggleSelect = (mid: string): (() => void) => {
}, [mid, selectedMessageStore]);
};

export const useToggleSelectAll = (): (() => void) => {
const { selectedMessageStore } = useContext(SelectedMessageContext);
return useCallback(() => {
selectedMessageStore.toggleAll(Array.from(selectedMessageStore.availableMessages));
}, [selectedMessageStore]);
};

export const useClearSelection = (): (() => void) => {
const { selectedMessageStore } = useContext(SelectedMessageContext);
return useCallback(() => {
selectedMessageStore.clearStore();
}, [selectedMessageStore]);
};

export const useCountSelected = (): number => {
const { selectedMessageStore } = useContext(SelectedMessageContext);

Expand All @@ -56,3 +82,16 @@ export const useCountSelected = (): number => {

return useSyncExternalStore(subscribe, getSnapshot);
};

export const useAvailableMessagesCount = () => {
const { selectedMessageStore } = useContext(SelectedMessageContext);

const subscribe = useCallback(
(callback: () => void): (() => void) => selectedMessageStore.on('change', callback),
[selectedMessageStore],
);

const getSnapshot = () => selectedMessageStore.availableMessagesCount();

return useSyncExternalStore(subscribe, getSnapshot);
};
5 changes: 4 additions & 1 deletion apps/meteor/client/views/room/body/RoomBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { useListIsAtBottom } from './hooks/useListIsAtBottom';
import { useQuoteMessageByUrl } from './hooks/useQuoteMessageByUrl';
import { useReadMessageWindowEvents } from './hooks/useReadMessageWindowEvents';
import { useRestoreScrollPosition } from './hooks/useRestoreScrollPosition';
import { useSelectAllAndScrollToTop } from './hooks/useSelectAllAndScrollToTop';
import { useHandleUnread } from './hooks/useUnreadMessages';

const RoomBody = (): ReactElement => {
Expand Down Expand Up @@ -116,6 +117,7 @@ const RoomBody = (): ReactElement => {
const { innerRef: restoreScrollPositionInnerRef } = useRestoreScrollPosition(room._id);

const { messageListRef } = useMessageListNavigation();
const { innerRef: selectAndScrollRef, selectAllAndScrollToTop } = useSelectAllAndScrollToTop();

const { handleNewMessageButtonClick, handleJumpToRecentButtonClick, handleComposerResize, hasNewMessages, newMessagesScrollRef } =
useHasNewMessages(room._id, user?._id, atBottomRef, {
Expand All @@ -133,7 +135,7 @@ const RoomBody = (): ReactElement => {
leaderBannerInnerRef,
unreadBarInnerRef,
getMoreInnerRef,

selectAndScrollRef,
messageListRef,
);

Expand Down Expand Up @@ -313,6 +315,7 @@ const RoomBody = (): ReactElement => {
onNavigateToPreviousMessage={handleNavigateToPreviousMessage}
onNavigateToNextMessage={handleNavigateToNextMessage}
onUploadFiles={handleUploadFiles}
onClickSelectAll={selectAllAndScrollToTop}
// TODO: send previewUrls param
// previewUrls={}
/>
Expand Down
5 changes: 4 additions & 1 deletion apps/meteor/client/views/room/body/RoomBodyV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { useListIsAtBottom } from './hooks/useListIsAtBottom';
import { useQuoteMessageByUrl } from './hooks/useQuoteMessageByUrl';
import { useReadMessageWindowEvents } from './hooks/useReadMessageWindowEvents';
import { useRestoreScrollPosition } from './hooks/useRestoreScrollPosition';
import { useSelectAllAndScrollToTop } from './hooks/useSelectAllAndScrollToTop';
import { useHandleUnread } from './hooks/useUnreadMessages';

const RoomBody = (): ReactElement => {
Expand Down Expand Up @@ -111,6 +112,7 @@ const RoomBody = (): ReactElement => {
const { innerRef: restoreScrollPositionInnerRef } = useRestoreScrollPosition(room._id);

const { messageListRef } = useMessageListNavigation();
const { innerRef: selectAndScrollRef, selectAllAndScrollToTop } = useSelectAllAndScrollToTop();

const { handleNewMessageButtonClick, handleJumpToRecentButtonClick, handleComposerResize, hasNewMessages, newMessagesScrollRef } =
useHasNewMessages(room._id, user?._id, atBottomRef, {
Expand All @@ -128,7 +130,7 @@ const RoomBody = (): ReactElement => {
sectionScrollRef,
unreadBarInnerRef,
getMoreInnerRef,

selectAndScrollRef,
messageListRef,
);

Expand Down Expand Up @@ -285,6 +287,7 @@ const RoomBody = (): ReactElement => {
onNavigateToPreviousMessage={handleNavigateToPreviousMessage}
onNavigateToNextMessage={handleNavigateToNextMessage}
onUploadFiles={handleUploadFiles}
onClickSelectAll={selectAllAndScrollToTop}
// TODO: send previewUrls param
// previewUrls={}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useRef } from 'react';

import { useToggleSelectAll } from '../../MessageList/contexts/SelectedMessagesContext';

export const useSelectAllAndScrollToTop = () => {
const ref = useRef<HTMLElement>(null);
const handleToggleAll = useToggleSelectAll();

const selectAllAndScrollToTop = () => {
ref.current?.scrollTo({ top: 0, behavior: 'smooth' });
handleToggleAll();
};

return { innerRef: ref, selectAllAndScrollToTop };
};
7 changes: 7 additions & 0 deletions apps/meteor/client/views/room/composer/ComposerContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import type { ComposerMessageProps } from './ComposerMessage';
import ComposerMessage from './ComposerMessage';
import ComposerOmnichannel from './ComposerOmnichannel';
import ComposerReadOnly from './ComposerReadOnly';
import ComposerSelectMessages from './ComposerSelectMessages';
import ComposerVoIP from './ComposerVoIP';
import { useRoom } from '../contexts/RoomContext';
import { useMessageComposerIsAnonymous } from './hooks/useMessageComposerIsAnonymous';
import { useMessageComposerIsArchived } from './hooks/useMessageComposerIsArchived';
import { useMessageComposerIsBlocked } from './hooks/useMessageComposerIsBlocked';
import { useMessageComposerIsReadOnly } from './hooks/useMessageComposerIsReadOnly';
import { useAirGappedRestriction } from '../../../hooks/useAirGappedRestriction';
import { useIsSelecting } from '../MessageList/contexts/SelectedMessagesContext';

const ComposerContainer = ({ children, ...props }: ComposerMessageProps): ReactElement => {
const room = useRoom();
Expand All @@ -28,6 +30,7 @@ const ComposerContainer = ({ children, ...props }: ComposerMessageProps): ReactE
const mustJoinWithCode = !props.subscription && room.joinCodeRequired && !canJoinWithoutCode;

const isAnonymous = useMessageComposerIsAnonymous();
const isSelectingMessages = useIsSelecting();
const isBlockedOrBlocker = useMessageComposerIsBlocked({ subscription: props.subscription });
const isArchived = useMessageComposerIsArchived(room._id, props.subscription);
const isReadOnly = useMessageComposerIsReadOnly(room._id);
Expand Down Expand Up @@ -74,6 +77,10 @@ const ComposerContainer = ({ children, ...props }: ComposerMessageProps): ReactE
return <ComposerBlocked />;
}

if (isSelectingMessages) {
return <ComposerSelectMessages {...props} />;
}

return (
<>
{children}
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/client/views/room/composer/ComposerMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type ComposerMessageProps = {
onNavigateToNextMessage?: () => void;
onNavigateToPreviousMessage?: () => void;
onUploadFiles?: (files: readonly File[]) => void;
onClickSelectAll?: () => void;
};

const ComposerMessage = ({ tmid, onSend, ...props }: ComposerMessageProps): ReactElement => {
Expand Down
Loading

0 comments on commit 8ba58ce

Please sign in to comment.