From 71fc3221a555e87fcd62cacb840feef923b65493 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Thu, 11 Nov 2021 22:52:22 -0300 Subject: [PATCH] Remove useCallbacks --- .storybook/mocks/meteor.js | 4 ++++ .storybook/preview.ts | 2 +- client/hooks/useCallbacks.js | 3 --- client/methods/updateMessage.js | 2 +- client/providers/UserProvider.tsx | 2 +- client/sidebar/header/UserDropdown.js | 2 +- client/startup/renderMessage/autolinker.ts | 2 +- client/startup/renderMessage/autotranslate.ts | 2 +- client/startup/renderMessage/emoji.ts | 2 +- client/startup/renderMessage/hexcolor.ts | 2 +- client/startup/renderMessage/highlightWords.ts | 2 +- client/startup/renderMessage/issuelink.ts | 2 +- client/startup/renderMessage/katex.ts | 2 +- client/startup/renderMessage/markdown.ts | 2 +- client/startup/renderMessage/mentionsMessage.ts | 2 +- client/startup/renderNotification/markdown.ts | 2 +- client/startup/streamMessage/autotranslate.ts | 2 +- client/startup/userStatusManuallySet.ts | 2 +- client/views/setupWizard/steps/AdminUserInformationStep.js | 3 +-- 19 files changed, 21 insertions(+), 21 deletions(-) delete mode 100644 client/hooks/useCallbacks.js diff --git a/.storybook/mocks/meteor.js b/.storybook/mocks/meteor.js index e4746cb59f0e..1b9d0e4f968c 100644 --- a/.storybook/mocks/meteor.js +++ b/.storybook/mocks/meteor.js @@ -13,6 +13,10 @@ export const Meteor = { on: () => {}, removeListener: () => {}, }), + StreamerCentral: { + on: () => {}, + removeListener: () => {}, + }, startup: () => {}, methods: () => {}, call: () => {}, diff --git a/.storybook/preview.ts b/.storybook/preview.ts index 2839f538c25e..39ebd205bdb1 100644 --- a/.storybook/preview.ts +++ b/.storybook/preview.ts @@ -1,4 +1,4 @@ -import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks'; +import { DocsPage, DocsContainer } from '@storybook/addon-docs'; import { addDecorator, addParameters } from '@storybook/react'; import { rocketChatDecorator } from './decorators'; diff --git a/client/hooks/useCallbacks.js b/client/hooks/useCallbacks.js deleted file mode 100644 index b727689643ba..000000000000 --- a/client/hooks/useCallbacks.js +++ /dev/null @@ -1,3 +0,0 @@ -import { callbacks } from '../../app/callbacks/lib/callbacks'; - -export const useCallbacks = () => callbacks; diff --git a/client/methods/updateMessage.js b/client/methods/updateMessage.js index 0aa84faefabc..b94958452c33 100644 --- a/client/methods/updateMessage.js +++ b/client/methods/updateMessage.js @@ -5,7 +5,7 @@ import moment from 'moment'; import _ from 'underscore'; import { hasAtLeastOnePermission } from '../../app/authorization/client'; -import { callbacks } from '../../app/callbacks/client'; +import { callbacks } from '../../app/callbacks/lib/callbacks'; import { ChatMessage } from '../../app/models/client'; import { settings } from '../../app/settings/client'; import { t } from '../../app/utils/client'; diff --git a/client/providers/UserProvider.tsx b/client/providers/UserProvider.tsx index 45a91b6adf97..ebf37f035fb7 100644 --- a/client/providers/UserProvider.tsx +++ b/client/providers/UserProvider.tsx @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; import React, { useMemo, FC } from 'react'; -import { callbacks } from '../../app/callbacks/client'; +import { callbacks } from '../../app/callbacks/lib/callbacks'; import { Subscriptions, Rooms } from '../../app/models/client'; import { getUserPreference } from '../../app/utils/client'; import { IRoom } from '../../definition/IRoom'; diff --git a/client/sidebar/header/UserDropdown.js b/client/sidebar/header/UserDropdown.js index c9a058bb50eb..246ebe59ca51 100644 --- a/client/sidebar/header/UserDropdown.js +++ b/client/sidebar/header/UserDropdown.js @@ -3,7 +3,7 @@ import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; import { FlowRouter } from 'meteor/kadira:flow-router'; import React from 'react'; -import { callbacks } from '../../../app/callbacks/client'; +import { callbacks } from '../../../app/callbacks/lib/callbacks'; import { popover, AccountBox, SideNav } from '../../../app/ui-utils/client'; import { userStatus } from '../../../app/user-status/client'; import MarkdownText from '../../components/MarkdownText'; diff --git a/client/startup/renderMessage/autolinker.ts b/client/startup/renderMessage/autolinker.ts index bf240aab3ea7..174da6e915a0 100644 --- a/client/startup/renderMessage/autolinker.ts +++ b/client/startup/renderMessage/autolinker.ts @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; -import { callbacks } from '../../../app/callbacks/client'; +import { callbacks } from '../../../app/callbacks/lib/callbacks'; import { settings } from '../../../app/settings/client'; Meteor.startup(() => { diff --git a/client/startup/renderMessage/autotranslate.ts b/client/startup/renderMessage/autotranslate.ts index 9142d4670a36..be727cd743db 100644 --- a/client/startup/renderMessage/autotranslate.ts +++ b/client/startup/renderMessage/autotranslate.ts @@ -2,7 +2,7 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; import { hasPermission } from '../../../app/authorization/client'; -import { callbacks } from '../../../app/callbacks/client'; +import { callbacks } from '../../../app/callbacks/lib/callbacks'; import { settings } from '../../../app/settings/client'; Meteor.startup(() => { diff --git a/client/startup/renderMessage/emoji.ts b/client/startup/renderMessage/emoji.ts index a5abc9d82773..ddb3bf318b45 100644 --- a/client/startup/renderMessage/emoji.ts +++ b/client/startup/renderMessage/emoji.ts @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; -import { callbacks } from '../../../app/callbacks/client'; +import { callbacks } from '../../../app/callbacks/lib/callbacks'; import { getUserPreference } from '../../../app/utils/client'; Meteor.startup(() => { diff --git a/client/startup/renderMessage/hexcolor.ts b/client/startup/renderMessage/hexcolor.ts index c24b9dc559e9..aba80d6f0a0a 100644 --- a/client/startup/renderMessage/hexcolor.ts +++ b/client/startup/renderMessage/hexcolor.ts @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; -import { callbacks } from '../../../app/callbacks/client'; +import { callbacks } from '../../../app/callbacks/lib/callbacks'; import { settings } from '../../../app/settings/client'; Meteor.startup(() => { diff --git a/client/startup/renderMessage/highlightWords.ts b/client/startup/renderMessage/highlightWords.ts index 928565d238c5..d95887d18b3a 100644 --- a/client/startup/renderMessage/highlightWords.ts +++ b/client/startup/renderMessage/highlightWords.ts @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; -import { callbacks } from '../../../app/callbacks/client'; +import { callbacks } from '../../../app/callbacks/lib/callbacks'; import { getUserPreference } from '../../../app/utils/client'; Meteor.startup(() => { diff --git a/client/startup/renderMessage/issuelink.ts b/client/startup/renderMessage/issuelink.ts index 7a465e15b19a..643615a6b684 100644 --- a/client/startup/renderMessage/issuelink.ts +++ b/client/startup/renderMessage/issuelink.ts @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; -import { callbacks } from '../../../app/callbacks/client'; +import { callbacks } from '../../../app/callbacks/lib/callbacks'; import { settings } from '../../../app/settings/client'; Meteor.startup(() => { diff --git a/client/startup/renderMessage/katex.ts b/client/startup/renderMessage/katex.ts index 4f5d042d1b3a..d48bb471a9b5 100644 --- a/client/startup/renderMessage/katex.ts +++ b/client/startup/renderMessage/katex.ts @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; -import { callbacks } from '../../../app/callbacks/client'; +import { callbacks } from '../../../app/callbacks/lib/callbacks'; import { settings } from '../../../app/settings/client'; Meteor.startup(() => { diff --git a/client/startup/renderMessage/markdown.ts b/client/startup/renderMessage/markdown.ts index e38f62bb89bc..e00aee6fb937 100644 --- a/client/startup/renderMessage/markdown.ts +++ b/client/startup/renderMessage/markdown.ts @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; -import { callbacks } from '../../../app/callbacks/client'; +import { callbacks } from '../../../app/callbacks/lib/callbacks'; import { settings } from '../../../app/settings/client'; Meteor.startup(() => { diff --git a/client/startup/renderMessage/mentionsMessage.ts b/client/startup/renderMessage/mentionsMessage.ts index e7dc900bc038..6db644599895 100644 --- a/client/startup/renderMessage/mentionsMessage.ts +++ b/client/startup/renderMessage/mentionsMessage.ts @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; -import { callbacks } from '../../../app/callbacks/client'; +import { callbacks } from '../../../app/callbacks/lib/callbacks'; import { Users } from '../../../app/models/client'; import { settings } from '../../../app/settings/client'; diff --git a/client/startup/renderNotification/markdown.ts b/client/startup/renderNotification/markdown.ts index 80b28bed11cc..c2f8179852b4 100644 --- a/client/startup/renderNotification/markdown.ts +++ b/client/startup/renderNotification/markdown.ts @@ -1,6 +1,6 @@ import { Meteor } from 'meteor/meteor'; -import { callbacks } from '../../../app/callbacks/client'; +import { callbacks } from '../../../app/callbacks/lib/callbacks'; import { settings } from '../../../app/settings/client'; Meteor.startup(() => { diff --git a/client/startup/streamMessage/autotranslate.ts b/client/startup/streamMessage/autotranslate.ts index c543998999b9..f788b1565109 100644 --- a/client/startup/streamMessage/autotranslate.ts +++ b/client/startup/streamMessage/autotranslate.ts @@ -2,7 +2,7 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; import { hasPermission } from '../../../app/authorization/client'; -import { callbacks } from '../../../app/callbacks/client'; +import { callbacks } from '../../../app/callbacks/lib/callbacks'; import { settings } from '../../../app/settings/client'; Meteor.startup(() => { diff --git a/client/startup/userStatusManuallySet.ts b/client/startup/userStatusManuallySet.ts index 46c052c88395..b969e621ba1d 100644 --- a/client/startup/userStatusManuallySet.ts +++ b/client/startup/userStatusManuallySet.ts @@ -1,6 +1,6 @@ import { Meteor } from 'meteor/meteor'; -import { callbacks } from '../../app/callbacks/client'; +import { callbacks } from '../../app/callbacks/lib/callbacks'; import { UserStatus } from '../../definition/UserStatus'; import { fireGlobalEvent } from '../lib/utils/fireGlobalEvent'; diff --git a/client/views/setupWizard/steps/AdminUserInformationStep.js b/client/views/setupWizard/steps/AdminUserInformationStep.js index ce14cfe7f609..dffa56414b64 100644 --- a/client/views/setupWizard/steps/AdminUserInformationStep.js +++ b/client/views/setupWizard/steps/AdminUserInformationStep.js @@ -10,13 +10,13 @@ import { import { useAutoFocus, useUniqueId } from '@rocket.chat/fuselage-hooks'; import React, { useMemo, useState, useEffect } from 'react'; +import { callbacks } from '../../../../app/callbacks/lib/callbacks'; import { useMethod } from '../../../contexts/ServerContext'; import { useSessionDispatch } from '../../../contexts/SessionContext'; import { useSetting } from '../../../contexts/SettingsContext'; import { useToastMessageDispatch } from '../../../contexts/ToastMessagesContext'; import { useTranslation } from '../../../contexts/TranslationContext'; import { useLoginWithPassword } from '../../../contexts/UserContext'; -import { useCallbacks } from '../../../hooks/useCallbacks'; import { Pager } from '../Pager'; import { Step } from '../Step'; import { StepHeader } from '../StepHeader'; @@ -27,7 +27,6 @@ function AdminUserInformationStep({ step, title, active }) { const defineUsername = useMethod('setUsername'); const setForceLogin = useSessionDispatch('forceLogin'); - const callbacks = useCallbacks(); const dispatchToastMessage = useToastMessageDispatch(); const registerAdminUser = async ({