From 6d501764eb9b3c43fb4a2e3767e28fc6faa3152d Mon Sep 17 00:00:00 2001 From: gabriellsh <40830821+gabriellsh@users.noreply.github.com> Date: Mon, 16 Aug 2021 10:42:43 -0300 Subject: [PATCH] Chore: Remove unused ChannelActions.js #22929 Co-authored-by: Douglas Fabris --- app/ui-utils/client/index.js | 1 - app/ui-utils/client/lib/ChannelActions.js | 98 ----------------------- 2 files changed, 99 deletions(-) delete mode 100644 app/ui-utils/client/lib/ChannelActions.js diff --git a/app/ui-utils/client/index.js b/app/ui-utils/client/index.js index ff68ad0c954..b94a368d4ea 100644 --- a/app/ui-utils/client/index.js +++ b/app/ui-utils/client/index.js @@ -3,7 +3,6 @@ export { SideNav } from './lib/SideNav'; export { AccountBox } from './lib/AccountBox'; export { menu } from './lib/menu'; export { call } from './lib/callMethod'; -export { erase, hide, leave } from './lib/ChannelActions'; export { MessageAction } from './lib/MessageAction'; export { messageBox } from './lib/messageBox'; export { popover } from './lib/popover'; diff --git a/app/ui-utils/client/lib/ChannelActions.js b/app/ui-utils/client/lib/ChannelActions.js deleted file mode 100644 index 4988f279085..00000000000 --- a/app/ui-utils/client/lib/ChannelActions.js +++ /dev/null @@ -1,98 +0,0 @@ -import { FlowRouter } from 'meteor/kadira:flow-router'; -import { Session } from 'meteor/session'; - -import { modal } from './modal'; -import { call } from './callMethod'; -import { RoomManager } from './RoomManager'; -import { t, UiTextContext, roomTypes, handleError } from '../../../utils'; - -export function hide(type, rid, name) { - const warnText = roomTypes.getConfig(type).getUiText(UiTextContext.HIDE_WARNING); - - modal.open({ - title: t('Are_you_sure'), - text: warnText ? t(warnText, name) : '', - type: 'warning', - showCancelButton: true, - confirmButtonColor: '#DD6B55', - confirmButtonText: t('Yes_hide_it'), - cancelButtonText: t('Cancel'), - closeOnConfirm: true, - dontAskAgain: { - action: 'hideRoom', - label: t('Hide_room'), - }, - html: false, - }, async function() { - if (['channel', 'group', 'direct'].includes(FlowRouter.getRouteName()) && (Session.get('openedRoom') === rid)) { - FlowRouter.go('home'); - } - - await call('hideRoom', rid); - if (rid === Session.get('openedRoom')) { - Session.delete('openedRoom'); - } - }); - return false; -} - -export async function leave(type, rid, name) { - const warnText = roomTypes.getConfig(type).getUiText(UiTextContext.LEAVE_WARNING); - - modal.open({ - title: t('Are_you_sure'), - text: warnText ? t(warnText, name) : '', - type: 'warning', - showCancelButton: true, - confirmButtonColor: '#DD6B55', - confirmButtonText: t('Yes_leave_it'), - cancelButtonText: t('Cancel'), - closeOnConfirm: false, - html: false, - }, async function(isConfirm) { - if (!isConfirm) { - return; - } - try { - await call('leaveRoom', rid); - modal.close(); - if (['channel', 'group', 'direct'].includes(FlowRouter.getRouteName()) && (Session.get('openedRoom') === rid)) { - FlowRouter.go('home'); - } - RoomManager.close(rid); - } catch (error) { - return modal.open({ - type: 'error', - title: t('Warning'), - text: handleError(error, false), - html: false, - }); - } - }); -} - -export function erase(rid) { - modal.open({ - title: t('Are_you_sure'), - text: t('Delete_Room_Warning'), - type: 'warning', - showCancelButton: true, - confirmButtonColor: '#DD6B55', - confirmButtonText: t('Yes_delete_it'), - cancelButtonText: t('Cancel'), - closeOnConfirm: false, - html: false, - }, async () => { - await call('eraseRoom', rid); - if (['channel', 'group', 'direct'].includes(FlowRouter.getRouteName()) && (Session.get('openedRoom') === rid)) { - FlowRouter.go('home'); - } - modal.open({ - title: t('Deleted'), - text: t('Room_has_been_deleted'), - type: 'success', - timer: 2000, - showConfirmButton: false, - }); - }); -}