Skip to content
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

[FIX] - Cancel button on Room Notification don't close contextualBar #20237

Merged
merged 2 commits into from
Feb 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import VerticalBar from '../../../../components/VerticalBar';
import { Preferences } from './components/Preferences';
import { NotificationByDevice } from './components/NotificationByDevice';
import { NotificationToogle } from './components/NotificationToogle';

import { useTabBarClose } from '../../providers/ToolboxProvider';

export const NotificationPreferences = ({
handleClose,
Expand All @@ -21,7 +21,6 @@ export const NotificationPreferences = ({
handlePlaySound,
handleOptions,
handleSaveButton,
handleCancelButton,
}) => {
const t = useTranslation();
return <>
Expand Down Expand Up @@ -54,24 +53,23 @@ export const NotificationPreferences = ({
</VerticalBar.ScrollableContent>
<VerticalBar.Footer>
<ButtonGroup stretch>
<Button onClick={handleCancelButton}>{t('Cancel')}</Button>
{handleClose && <Button onClick={handleClose}>{t('Cancel')}</Button>}
<Button primary disabled={!formHasUnsavedChanges} onClick={handleSaveButton}>{t('Save')}</Button>
</ButtonGroup>
</VerticalBar.Footer>
</>;
};

export default React.memo(({ tabBar, rid }) => {
export default React.memo(({ rid }) => {
const t = useTranslation();

const subscription = useUserSubscription(rid);

const customSound = useCustomSound();

const handleClose = useMutableCallback(() => tabBar && tabBar.close());
const handleClose = useTabBarClose();
const saveSettings = useEndpointActionExperimental('POST', 'rooms.saveNotification', t('Room_updated_successfully'));

const { values, handlers, hasUnsavedChanges, commit, reset } = useForm(
const { values, handlers, hasUnsavedChanges, commit } = useForm(
{
turnOn: !subscription.disableNotifications,
muteGroupMentions: subscription.muteGroupMentions,
Expand All @@ -84,7 +82,6 @@ export default React.memo(({ tabBar, rid }) => {
},
);


const defaultOption = [
['default', t('Default')],
['all', t('All_messages')],
Expand Down Expand Up @@ -136,7 +133,6 @@ export default React.memo(({ tabBar, rid }) => {
handlePlaySound={handlePlaySound}
handleOptions={handleOptions}
handleSaveButton={handleSaveButton}
handleCancelButton={reset}
/>
);
});