-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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/user-info-alignment
- Loading branch information
Showing
29 changed files
with
1,212 additions
and
1,199 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 | ||
--- | ||
|
||
Fixes an issue where premium settings were using the wrong `Tag` variant in Omnichannel Appearance configuration |
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 | ||
--- | ||
|
||
fixed an issue that caused the conference call ringer to fail to accept calls if the user logged out and in again |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import type { RoomType } from '@rocket.chat/core-typings'; | ||
import { useEffectEvent } from '@rocket.chat/fuselage-hooks'; | ||
import type { TranslationKey } from '@rocket.chat/ui-contexts'; | ||
import { useEndpoint, useSetModal, useToastMessageDispatch, useRouter, useUserId } from '@rocket.chat/ui-contexts'; | ||
import { useMutation } from '@tanstack/react-query'; | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { useDontAskAgain } from './useDontAskAgain'; | ||
import { UiTextContext } from '../../definition/IRoomTypeConfig'; | ||
import { GenericModalDoNotAskAgain } from '../components/GenericModal'; | ||
import { updateSubscription } from '../lib/mutationEffects/updateSubscription'; | ||
import { roomCoordinator } from '../lib/rooms/roomCoordinator'; | ||
|
||
type HideRoomProps = { | ||
rid: string; | ||
type: RoomType; | ||
name: string; | ||
}; | ||
|
||
type HideRoomOptions = { | ||
redirect?: boolean; | ||
}; | ||
|
||
const CLOSE_ENDPOINTS_BY_ROOM_TYPE = { | ||
p: '/v1/groups.close', // private | ||
c: '/v1/channels.close', // channel | ||
d: '/v1/im.close', // direct message | ||
v: '/v1/channels.close', // omnichannel voip | ||
l: '/v1/channels.close', // livechat | ||
} as const; | ||
|
||
export const useHideRoomAction = ({ rid: roomId, type, name }: HideRoomProps, { redirect = true }: HideRoomOptions = {}) => { | ||
const { t } = useTranslation(); | ||
const setModal = useSetModal(); | ||
const closeModal = useEffectEvent(() => setModal()); | ||
const dispatchToastMessage = useToastMessageDispatch(); | ||
const dontAskHideRoom = useDontAskAgain('hideRoom'); | ||
const router = useRouter(); | ||
const userId = useUserId(); | ||
|
||
const hideRoomEndpoint = useEndpoint('POST', CLOSE_ENDPOINTS_BY_ROOM_TYPE[type]); | ||
|
||
const hideRoom = useMutation({ | ||
mutationFn: () => hideRoomEndpoint({ roomId }), | ||
onMutate: async () => { | ||
closeModal(); | ||
|
||
if (userId) { | ||
return updateSubscription(roomId, userId, { alert: false, open: false }); | ||
} | ||
}, | ||
onSuccess: () => { | ||
if (redirect) { | ||
router.navigate('/home'); | ||
} | ||
}, | ||
onError: async (error, _, rollbackDocument) => { | ||
dispatchToastMessage({ type: 'error', message: error }); | ||
|
||
if (userId && rollbackDocument) { | ||
const { alert, open } = rollbackDocument; | ||
updateSubscription(roomId, userId, { alert, open }); | ||
} | ||
}, | ||
}); | ||
|
||
const handleHide = useEffectEvent(async () => { | ||
const warnText = roomCoordinator.getRoomDirectives(type).getUiText(UiTextContext.HIDE_WARNING); | ||
|
||
if (dontAskHideRoom) { | ||
hideRoom.mutate(); | ||
return; | ||
} | ||
|
||
setModal( | ||
<GenericModalDoNotAskAgain | ||
variant='danger' | ||
confirmText={t('Yes_hide_it')} | ||
cancelText={t('Cancel')} | ||
onClose={closeModal} | ||
onCancel={closeModal} | ||
onConfirm={() => hideRoom.mutate()} | ||
dontAskAgain={{ | ||
action: 'hideRoom', | ||
label: t('Hide_room'), | ||
}} | ||
> | ||
{t(warnText as TranslationKey, { postProcess: 'sprintf', sprintf: [name] })} | ||
</GenericModalDoNotAskAgain>, | ||
); | ||
}); | ||
|
||
return handleHide; | ||
}; |
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
11 changes: 11 additions & 0 deletions
11
apps/meteor/client/lib/mutationEffects/updateSubscription.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,11 @@ | ||
import type { ISubscription } from '@rocket.chat/core-typings'; | ||
|
||
import { Subscriptions } from '../../../app/models/client'; | ||
|
||
export const updateSubscription = (roomId: string, userId: string, data: Partial<ISubscription>) => { | ||
const oldDocument = Subscriptions.findOne({ 'rid': roomId, 'u._id': userId }); | ||
|
||
Subscriptions.update({ 'rid': roomId, 'u._id': userId }, { $set: data }); | ||
|
||
return oldDocument; | ||
}; |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import './hideRoom'; | ||
import './openRoom'; | ||
import './pinMessage'; | ||
import './unpinMessage'; | ||
|
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
18 changes: 9 additions & 9 deletions
18
apps/meteor/client/views/omnichannel/appearance/AppearanceFieldLabel.tsx
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 |
---|---|---|
@@ -1,32 +1,32 @@ | ||
import { FieldLabel as BaseFieldLabel, Box, Tag } from '@rocket.chat/fuselage'; | ||
import { FieldLabel, Box, Tag } from '@rocket.chat/fuselage'; | ||
import type { ComponentProps } from 'react'; | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { useHasLicenseModule } from '../../../hooks/useHasLicenseModule'; | ||
|
||
type FieldLabelProps = ComponentProps<typeof BaseFieldLabel> & { | ||
type AppearanceFieldLabelProps = ComponentProps<typeof FieldLabel> & { | ||
premium?: boolean; | ||
children: string; | ||
}; | ||
|
||
const FieldLabel = ({ children: label, premium = false }: FieldLabelProps) => { | ||
const AppearanceFieldLabel = ({ children, premium = false }: AppearanceFieldLabelProps) => { | ||
const { t } = useTranslation(); | ||
const hasLicense = useHasLicenseModule('livechat-enterprise'); | ||
const shouldDisableEnterprise = premium && !hasLicense; | ||
|
||
if (!shouldDisableEnterprise) { | ||
return <BaseFieldLabel>{label}</BaseFieldLabel>; | ||
return <FieldLabel>{children}</FieldLabel>; | ||
} | ||
|
||
return ( | ||
<BaseFieldLabel> | ||
<FieldLabel> | ||
<Box is='span' mie={4}> | ||
{label} | ||
{children} | ||
</Box> | ||
<Tag variant='primary'>{t('Premium')}</Tag> | ||
</BaseFieldLabel> | ||
<Tag variant='featured'>{t('Premium')}</Tag> | ||
</FieldLabel> | ||
); | ||
}; | ||
|
||
export default FieldLabel; | ||
export default AppearanceFieldLabel; |
Oops, something went wrong.