|
1 | | -import { isRoomFederated, type IInviteSubscription } from '@rocket.chat/core-typings'; |
| 1 | +import { isRoomFederated } from '@rocket.chat/core-typings'; |
| 2 | +import type { IUser, IInviteSubscription } from '@rocket.chat/core-typings'; |
2 | 3 | import type { ComponentProps } from 'react'; |
3 | 4 | import { useTranslation } from 'react-i18next'; |
4 | 5 |
|
5 | 6 | import Header from './Header'; |
6 | 7 | import RoomInviteBody from './body/RoomInviteBody'; |
| 8 | +import { useGoToHomeOnRemoved } from './body/hooks/useGoToHomeOnRemoved'; |
7 | 9 | import type { IRoomWithFederationOriginalName } from './contexts/RoomContext'; |
8 | 10 | import { useRoomInvitation } from './hooks/useRoomInvitation'; |
9 | 11 | import RoomLayout from './layout/RoomLayout'; |
10 | 12 | import { links } from '../../lib/links'; |
11 | 13 |
|
12 | 14 | type RoomInviteProps = Omit<ComponentProps<typeof RoomLayout>, 'header' | 'body' | 'aside'> & { |
| 15 | + userId?: IUser['_id']; |
13 | 16 | room: IRoomWithFederationOriginalName; |
14 | 17 | subscription: IInviteSubscription; |
15 | 18 | }; |
16 | 19 |
|
17 | | -const RoomInvite = ({ room, subscription, ...props }: RoomInviteProps) => { |
| 20 | +const RoomInvite = ({ room, subscription, userId, ...props }: RoomInviteProps) => { |
18 | 21 | const { t } = useTranslation(); |
19 | 22 | const { acceptInvite, rejectInvite, isPending } = useRoomInvitation(room); |
20 | 23 |
|
21 | 24 | const infoLink = isRoomFederated(room) ? { label: t('Learn_more_about_Federation'), href: links.go.matrixFederation } : undefined; |
22 | 25 |
|
| 26 | + useGoToHomeOnRemoved(room, userId); |
| 27 | + |
23 | 28 | return ( |
24 | 29 | <RoomLayout |
25 | 30 | {...props} |
|
0 commit comments