-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
regression: missing permission checks on voip for team collab (#33518)
- Loading branch information
1 parent
31eb47f
commit 5cc9ac5
Showing
14 changed files
with
159 additions
and
55 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
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
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
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
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
16 changes: 7 additions & 9 deletions
16
apps/meteor/client/views/admin/users/voip/AssignExtensionButton.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
37 changes: 37 additions & 0 deletions
37
apps/meteor/client/views/admin/users/voip/hooks/useVoipExtensionAction.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { useEffectEvent } from '@rocket.chat/fuselage-hooks'; | ||
import { useSetModal } from '@rocket.chat/ui-contexts'; | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import type { Action } from '../../../../hooks/useActionSpread'; | ||
import AssignExtensionModal from '../AssignExtensionModal'; | ||
import RemoveExtensionModal from '../RemoveExtensionModal'; | ||
|
||
type VoipExtensionActionParams = { | ||
name: string; | ||
username: string; | ||
extension?: string; | ||
enabled: boolean; | ||
}; | ||
|
||
export const useVoipExtensionAction = ({ name, username, extension, enabled }: VoipExtensionActionParams): Action | undefined => { | ||
const { t } = useTranslation(); | ||
const setModal = useSetModal(); | ||
|
||
const handleExtensionAssignment = useEffectEvent(() => { | ||
if (extension) { | ||
setModal(<RemoveExtensionModal name={name} username={username} extension={extension} onClose={(): void => setModal(null)} />); | ||
return; | ||
} | ||
|
||
setModal(<AssignExtensionModal defaultUsername={username} onClose={(): void => setModal(null)} />); | ||
}); | ||
|
||
return enabled | ||
? { | ||
icon: extension ? 'phone-disabled' : 'phone', | ||
label: extension ? t('Unassign_extension') : t('Assign_extension'), | ||
action: handleExtensionAssignment, | ||
} | ||
: undefined; | ||
}; |
Oops, something went wrong.