-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/memberList
- Loading branch information
Showing
8 changed files
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rocket.chat/meteor": patch | ||
--- | ||
|
||
fix: Omnichannel contact table not being updated after add/edit/remove |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rocket.chat/meteor': minor | ||
--- | ||
|
||
fix: Handle live subscription removal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
apps/meteor/client/views/omnichannel/directory/contacts/hooks/useCurrentContacts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { GETLivechatRoomsParams, OperationResult } from '@rocket.chat/rest-typings'; | ||
import { useEndpoint } from '@rocket.chat/ui-contexts'; | ||
import type { UseQueryResult } from '@tanstack/react-query'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
export const useCurrentContacts = ( | ||
query: GETLivechatRoomsParams, | ||
): UseQueryResult<OperationResult<'GET', '/v1/livechat/visitors.search'>> => { | ||
const currentContacts = useEndpoint('GET', '/v1/livechat/visitors.search'); | ||
|
||
return useQuery(['current-contacts', query], () => currentContacts(query)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
apps/meteor/client/views/room/components/body/hooks/useGoToHomeOnRemoved.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import type { IRoom } from '@rocket.chat/core-typings'; | ||
import { useRoute, useStream, useToastMessageDispatch, useTranslation } from '@rocket.chat/ui-contexts'; | ||
import { useQueryClient } from '@tanstack/react-query'; | ||
import { useEffect } from 'react'; | ||
|
||
export function useGoToHomeOnRemoved(room: IRoom, userId: string | undefined): void { | ||
const homeRouter = useRoute('home'); | ||
const queryClient = useQueryClient(); | ||
const dispatchToastMessage = useToastMessageDispatch(); | ||
const subscribeToNotifyUser = useStream('notify-user'); | ||
const t = useTranslation(); | ||
|
||
useEffect(() => { | ||
if (!userId) { | ||
return; | ||
} | ||
|
||
const unSubscribeFromNotifyUser = subscribeToNotifyUser(`${userId}/subscriptions-changed`, (event, subscription) => { | ||
if (event === 'removed' && subscription.rid === room._id) { | ||
queryClient.invalidateQueries(['rooms', room._id]); | ||
dispatchToastMessage({ | ||
type: 'info', | ||
message: t('You_have_been_removed_from__roomName_', { | ||
roomName: room?.fname || room?.name || '', | ||
}), | ||
}); | ||
homeRouter.push({}); | ||
} | ||
}); | ||
|
||
return unSubscribeFromNotifyUser; | ||
}, [userId, homeRouter, subscribeToNotifyUser, room._id, room?.fname, room?.name, t, dispatchToastMessage, queryClient]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters