-
Notifications
You must be signed in to change notification settings - Fork 13.6k
feat: Show confirmation modal with compiled warnings when changing settings #40909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
KevLehman
merged 5 commits into
chore/confirm-modal-store-change
from
chore/confirm-modal-store-change-suggestion
Jun 12, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4f3e8e1
chore: Move ModalProvider up in the provider hierarchy (MeteorProvider)
gabriellsh 7729042
feat: WIP - Show a confirmation modal with compiled `alert`s from cha…
gabriellsh af88e7b
fix
KevLehman c49f9e4
last
KevLehman 5af1e11
last
KevLehman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,72 @@ | ||
| import type { ISetting } from '@rocket.chat/core-typings'; | ||
| import { Box, Callout } from '@rocket.chat/fuselage'; | ||
| import { GenericModal } from '@rocket.chat/ui-client'; | ||
| import { useSetModal } from '@rocket.chat/ui-contexts'; | ||
| import { useCallback } from 'react'; | ||
| import { Trans, useTranslation } from 'react-i18next'; | ||
|
|
||
| export const useShowSettingAlerts = () => { | ||
| const { t, i18n } = useTranslation(); | ||
| const setModal = useSetModal(); | ||
|
|
||
| const showAlerts = useCallback( | ||
| (persistedSettingsWithAlert: ISetting[]) => { | ||
| return new Promise<boolean>((resolve) => { | ||
| setModal( | ||
| <GenericModal | ||
| variant='danger' | ||
| icon={null} | ||
| maxHeight='x600' | ||
| title={t('Confirm_settings_change')} | ||
| confirmText={t('Save_changes')} | ||
| cancelText={t('Cancel')} | ||
| onConfirm={() => { | ||
| resolve(true); | ||
| setModal(null); | ||
| }} | ||
| onCancel={() => { | ||
| resolve(false); | ||
| return setModal(null); | ||
| }} | ||
| onClose={() => { | ||
| resolve(false); | ||
| return setModal(null); | ||
| }} | ||
| > | ||
| {persistedSettingsWithAlert.map(({ _id, i18nLabel, alert }) => { | ||
| if (!alert) { | ||
| return null; | ||
| } | ||
|
|
||
| const labelText = (i18n.exists(i18nLabel) && t(i18nLabel)) || (i18n.exists(_id) && t(_id)) || i18nLabel || _id; | ||
|
|
||
| return ( | ||
| <Box key={_id} mbe={24}> | ||
| <Box fontScale='h4' mbe={8}> | ||
| {labelText} | ||
| </Box> | ||
| <Callout type='warning'> | ||
| <Trans | ||
| i18nKey={i18n.exists(alert) ? alert : undefined} | ||
| defaults={alert} | ||
| components={{ | ||
| b: <b />, | ||
| strong: <strong />, | ||
| br: <br />, | ||
| ul: <ul />, | ||
| li: <li />, | ||
| }} | ||
| /> | ||
| </Callout> | ||
| </Box> | ||
| ); | ||
| })} | ||
| </GenericModal>, | ||
| ); | ||
| }); | ||
| }, | ||
| [t, i18n, setModal], | ||
| ); | ||
|
|
||
| return showAlerts; | ||
| }; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.