From 5dc95caaf1dd3d831251f4dc4149b9cd751afdc3 Mon Sep 17 00:00:00 2001 From: Marcos Spessatto Defendi Date: Fri, 15 Feb 2019 14:42:52 -0200 Subject: [PATCH] Remove dependency of RC namespace in rc-livechat/server/publications (#13383) * Remove some dependencies inside rocketchat-lib/client (#13210) * Move function to rc-utils * Change import from to export directly * Removing duplicated dependency and remove old code * Import some variables to remove dependency of RC namespace * Remove some dependencies inside rocketchat-lib/lib (#13212) * Move some functions from lib to rc-ui-utils * Move some functions from lib ro rc-utils * Remove hostname from RC namespace * Import variables to remove dependency of RC namespace * Remove some dependencies inside rocketchat-lib/server/functions (#13214) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Remove some dependencies inside rocketchat-lib/server/lib (#13217) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Remove some dependencies inside rocketchat-lib/server/methods (#13218) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Remove some dependencies inside rocketchat-lib/server/startup, publications... (#13222) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings (#13223) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export functions and lib function of rc-lib but keep it inside RC namespace (#13225) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Fix missed exports and re-add some functions to RC namespace * Import variables from functions and lib to remove RC namespace dependency (#13226) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm (#13227) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search (#13231) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Remove dependency of RC namespace in meteor saml (#13233) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme (#13234) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Remove dependency of RC namespace in rc-2fa (#13235) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Move 2FA Users model to rc-models * Remove dependency of RC namespace in rc-2fa * Remove dependency of RC namespace in rc-action-links (#13236) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Move 2FA Users model to rc-models * Remove dependency of RC namespace in rc-2fa * Remove dependency of RC namespace in rc-action-links * Add action links in the RC namespace * Remove dependency of RC namespace in rc-analytics and rc-assets (#13237) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Move 2FA Users model to rc-models * Remove dependency of RC namespace in rc-2fa * Remove dependency of RC namespace in rc-action-links * Add action links in the RC namespace * Remove dependency of RC namespace in rc-analytics * Remove dependency of RC namespace in rc-assets * Add Assets in RC namespace * Rename Assets variable to avoid conflicts * Fix rename Assets * Remove dependency of RC namespace in rc-markdown, rc-autolinker and rc-autotranslate (#13240) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Move 2FA Users model to rc-models * Remove dependency of RC namespace in rc-2fa * Remove dependency of RC namespace in rc-action-links * Add action links in the RC namespace * Remove dependency of RC namespace in rc-analytics * Remove dependency of RC namespace in rc-assets * Add Assets in RC namespace * Remove dependency of RC namespace in rc-autolinker * Move autotranslate models to rc-models * Partial remove dependency of Rc namespace in rc-autotranslate * Remove dependency of RC namespace in rc-markdown * Finish of remotion of RC namespace in rc-autotranslate * Import Autotranslate where it has been used * Fix lint * Rename Assets variable to avoid conflicts * Fix rename Assets * Fix wrong imports * Remove dependency of RC namespace in rc-blockstack, bot-helpers and cas (#13246) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Move 2FA Users model to rc-models * Remove dependency of RC namespace in rc-2fa * Remove dependency of RC namespace in rc-action-links * Add action links in the RC namespace * Remove dependency of RC namespace in rc-analytics * Remove dependency of RC namespace in rc-assets * Add Assets in RC namespace * Remove dependency of RC namespace in rc-autolinker * Move autotranslate models to rc-models * Partial remove dependency of Rc namespace in rc-autotranslate * Remove dependency of RC namespace in rc-markdown * Finish of remotion of RC namespace in rc-autotranslate * Import Autotranslate where it has been used * Fix lint * Rename Assets variable to avoid conflicts * Fix rename Assets * Remove dependency of RC namespace in rc-blockstack * Remove RC dependency in bot-helpers * Remove RC dependency in rc-cas * Fix wrong imports * Remove dependency of RC namespace in rc-channel-settings (#13251) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Move 2FA Users model to rc-models * Remove dependency of RC namespace in rc-2fa * Remove dependency of RC namespace in rc-action-links * Add action links in the RC namespace * Remove dependency of RC namespace in rc-analytics * Remove dependency of RC namespace in rc-assets * Add Assets in RC namespace * Remove dependency of RC namespace in rc-autolinker * Move autotranslate models to rc-models * Partial remove dependency of Rc namespace in rc-autotranslate * Remove dependency of RC namespace in rc-markdown * Finish of remotion of RC namespace in rc-autotranslate * Import Autotranslate where it has been used * Fix lint * Rename Assets variable to avoid conflicts * Fix rename Assets * Remove dependency of RC namespace in rc-blockstack * Remove RC dependency in bot-helpers * Remove RC dependency in rc-cas * Move some functions from tokenpass to channel settings and models * Move some function from livestream to channel settings * Remove dependency of RC namespace in rc-channel-settings * Fix wrong imports * readd saveRoomName to RC namespace * Remove dependency of RC namespace in rc-channel-mail-messages and cloud (#13254) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Move 2FA Users model to rc-models * Remove dependency of RC namespace in rc-2fa * Remove dependency of RC namespace in rc-action-links * Add action links in the RC namespace * Remove dependency of RC namespace in rc-analytics * Remove dependency of RC namespace in rc-assets * Add Assets in RC namespace * Remove dependency of RC namespace in rc-autolinker * Move autotranslate models to rc-models * Partial remove dependency of Rc namespace in rc-autotranslate * Remove dependency of RC namespace in rc-markdown * Finish of remotion of RC namespace in rc-autotranslate * Import Autotranslate where it has been used * Fix lint * Rename Assets variable to avoid conflicts * Fix rename Assets * Remove dependency of RC namespace in rc-blockstack * Remove RC dependency in bot-helpers * Remove RC dependency in rc-cas * Move some functions from tokenpass to channel settings and models * Move some function from livestream to channel settings * Remove dependency of RC namespace in rc-channel-settings * Fix wrong imports * Remove dependency of RC namespace in rc-channel-mail-messages * Remove dependency of RC namespace in rc-cloud * Remove dependency of RC namespace in rc-colors, cors, crowd and dolphin (#13255) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Move 2FA Users model to rc-models * Remove dependency of RC namespace in rc-2fa * Remove dependency of RC namespace in rc-action-links * Add action links in the RC namespace * Remove dependency of RC namespace in rc-analytics * Remove dependency of RC namespace in rc-assets * Add Assets in RC namespace * Remove dependency of RC namespace in rc-autolinker * Move autotranslate models to rc-models * Partial remove dependency of Rc namespace in rc-autotranslate * Remove dependency of RC namespace in rc-markdown * Finish of remotion of RC namespace in rc-autotranslate * Import Autotranslate where it has been used * Fix lint * Rename Assets variable to avoid conflicts * Fix rename Assets * Remove dependency of RC namespace in rc-blockstack * Remove RC dependency in bot-helpers * Remove RC dependency in rc-cas * Move some functions from tokenpass to channel settings and models * Move some function from livestream to channel settings * Remove dependency of RC namespace in rc-channel-settings * Fix wrong imports * Remove dependency of RC namespace in rc-channel-mail-messages * Remove dependency of RC namespace in rc-cloud * Remove dependency of RC namespace in rc-colors * Remove dependency of RC namespace in rc-cors * Remove dependency of RC namespace in rc-crowd * Remove dependency of RC namespace in rc-dolphin * Remove dependency of RC namespace in rc-emoji-custom and drupal (#13256) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Move 2FA Users model to rc-models * Remove dependency of RC namespace in rc-2fa * Remove dependency of RC namespace in rc-action-links * Add action links in the RC namespace * Remove dependency of RC namespace in rc-analytics * Remove dependency of RC namespace in rc-assets * Add Assets in RC namespace * Remove dependency of RC namespace in rc-autolinker * Move autotranslate models to rc-models * Partial remove dependency of Rc namespace in rc-autotranslate * Remove dependency of RC namespace in rc-markdown * Finish of remotion of RC namespace in rc-autotranslate * Import Autotranslate where it has been used * Fix lint * Rename Assets variable to avoid conflicts * Fix rename Assets * Remove dependency of RC namespace in rc-blockstack * Remove RC dependency in bot-helpers * Remove RC dependency in rc-cas * Move some functions from tokenpass to channel settings and models * Move some function from livestream to channel settings * Remove dependency of RC namespace in rc-channel-settings * Fix wrong imports * Remove dependency of RC namespace in rc-channel-mail-messages * Remove dependency of RC namespace in rc-cloud * Remove dependency of RC namespace in rc-colors * Remove dependency of RC namespace in rc-cors * Remove dependency of RC namespace in rc-crowd * Remove dependency of RC namespace in rc-dolphin * Remove dependency of RC namespace in rc-drupal * Move Emoji custom server and client models to rc-models * Remove dependency of RC namespace in rc-emoji-custom * Remove dependency of RC namespace in rc-emojione, error-handler, gh-enterprise and gitlab (#13257) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Move 2FA Users model to rc-models * Remove dependency of RC namespace in rc-2fa * Remove dependency of RC namespace in rc-action-links * Add action links in the RC namespace * Remove dependency of RC namespace in rc-analytics * Remove dependency of RC namespace in rc-assets * Add Assets in RC namespace * Remove dependency of RC namespace in rc-autolinker * Move autotranslate models to rc-models * Partial remove dependency of Rc namespace in rc-autotranslate * Remove dependency of RC namespace in rc-markdown * Finish of remotion of RC namespace in rc-autotranslate * Import Autotranslate where it has been used * Fix lint * Rename Assets variable to avoid conflicts * Fix rename Assets * Remove dependency of RC namespace in rc-blockstack * Remove RC dependency in bot-helpers * Remove RC dependency in rc-cas * Move some functions from tokenpass to channel settings and models * Move some function from livestream to channel settings * Remove dependency of RC namespace in rc-channel-settings * Fix wrong imports * Remove dependency of RC namespace in rc-channel-mail-messages * Remove dependency of RC namespace in rc-cloud * Remove dependency of RC namespace in rc-colors * Remove dependency of RC namespace in rc-cors * Remove dependency of RC namespace in rc-crowd * Remove dependency of RC namespace in rc-dolphin * Remove dependency of RC namespace in rc-drupal * Move Emoji custom server and client models to rc-models * Remove dependency of RC namespace in rc-emoji-custom * Remove dependency of RC namespace in rc-emojione * Remove dependency of RC namespace in rc-error-handler * Remove dependency of RC namespace in rc-gh-enterprise * Remove dependency of RC namespace in rc-gitlab * Remove dependency of RC namespace in rc-google-natural-language, grant, google-vision and highlight-words (#13258) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Move 2FA Users model to rc-models * Remove dependency of RC namespace in rc-2fa * Remove dependency of RC namespace in rc-action-links * Add action links in the RC namespace * Remove dependency of RC namespace in rc-analytics * Remove dependency of RC namespace in rc-assets * Add Assets in RC namespace * Remove dependency of RC namespace in rc-autolinker * Move autotranslate models to rc-models * Partial remove dependency of Rc namespace in rc-autotranslate * Remove dependency of RC namespace in rc-markdown * Finish of remotion of RC namespace in rc-autotranslate * Import Autotranslate where it has been used * Fix lint * Rename Assets variable to avoid conflicts * Fix rename Assets * Remove dependency of RC namespace in rc-blockstack * Remove RC dependency in bot-helpers * Remove RC dependency in rc-cas * Move some functions from tokenpass to channel settings and models * Move some function from livestream to channel settings * Remove dependency of RC namespace in rc-channel-settings * Fix wrong imports * Remove dependency of RC namespace in rc-channel-mail-messages * Remove dependency of RC namespace in rc-cloud * Remove dependency of RC namespace in rc-colors * Remove dependency of RC namespace in rc-cors * Remove dependency of RC namespace in rc-crowd * Remove dependency of RC namespace in rc-dolphin * Remove dependency of RC namespace in rc-drupal * Move Emoji custom server and client models to rc-models * Remove dependency of RC namespace in rc-emoji-custom * Remove dependency of RC namespace in rc-emojione * Remove dependency of RC namespace in rc-error-handler * Remove dependency of RC namespace in rc-gh-enterprise * Remove dependency of RC namespace in rc-gitlab * Remove dependency of RC namespace in rc-google-natural-language * Remove dependency of RC namespace in rc-grant * Remove dependency of RC namespace in rc-highlight-words * Remove dependency of RC namespace in rc-google-vision * Fix lint * Remove dependency of RC namespace in rc-iframe-login and all imports, except hipchat-enterprise (#13259) * Move integrations models to rc-models * Move composeMessage function to rc-utils * Move PushNotifications class to push-notifications package * Import variables to remove dependency of RC namespace * Import variables to remove RC namespace dependency inside rc-lib/server/lib * Import variables to remove RC namespace inside rc-lib/server/methods * Import variables to remove dependency with RC namespace * Remove duplicated server settings located in rc-lib * Export function and lib function of rc-lib but keep it inside RC namespace * Import variables from functions and lib to remove RC namespace dependency * Remove dependency of RC namespace in rc-sandstorm * Remove dependency of RC namespace in chatpal-search * Move CreadentialTokens model to rc-models * Move getUsernameSuggestion function and method from server/ to rc-lib * Remove dependency of RC namespace in meteor saml * Remove dependency of RC namespace in rc-theme * Move 2FA Users model to rc-models * Remove dependency of RC namespace in rc-2fa * Remove dependency of RC namespace in rc-action-links * Add action links in the RC namespace * Remove dependency of RC namespace in rc-analytics * Remove dependency of RC namespace in rc-assets * Add Assets in RC namespace * Remove dependency of RC namespace in rc-autolinker * Move autotranslate models to rc-models * Partial remove dependency of Rc namespace in rc-autotranslate * Remove dependency of RC namespace in rc-markdown * Finish of remotion of RC namespace in rc-autotranslate * Import Autotranslate where it has been used * Fix lint * Rename Assets variable to avoid conflicts * Fix rename Assets * Remove dependency of RC namespace in rc-blockstack * Remove RC dependency in bot-helpers * Remove RC dependency in rc-cas * Move some functions from tokenpass to channel settings and models * Move some function from livestream to channel settings * Remove dependency of RC namespace in rc-channel-settings * Fix wrong imports * Remove dependency of RC namespace in rc-channel-mail-messages * Remove dependency of RC namespace in rc-cloud * Remove dependency of RC namespace in rc-colors * Remove dependency of RC namespace in rc-cors * Remove dependency of RC namespace in rc-crowd * Remove dependency of RC namespace in rc-dolphin * Remove dependency of RC namespace in rc-drupal * Move Emoji custom server and client models to rc-models * Remove dependency of RC namespace in rc-emoji-custom * Remove dependency of RC namespace in rc-emojione * Remove dependency of RC namespace in rc-error-handler * Remove dependency of RC namespace in rc-gh-enterprise * Remove dependency of RC namespace in rc-gitlab * Remove dependency of RC namespace in rc-google-natural-language * Remove dependency of RC namespace in rc-grant * Remove dependency of RC namespace in rc-highlight-words * Remove dependency of RC namespace in rc-google-vision * Fix lint * Remove dependency of RC namespace in rc-iframe-login * Remove dependency of RC namespace in all importes, except hipchat-enterprise * Move RestAPI client to rc-api package * Remove dependency of RC namespace in rc-api/helpers and api.js * Remove dependency of RC namespace on half of api files * Partial Remove dependency of RC namespace in rc-api * import API where it was being used by the RC namespace * Move processWebhookMessage function to rc-lib package * Remove API from RC namespace and import missing function that was being used with namespace * Remove dependency of RC namespace in rc-graphql * Fix import from wrong package * Remove dependency of RC namespace in rc-importer * Remove dependency of RC namespace in rc-issue-links * Remove dependency of RC namespace in rc-katex * Move templateVarHandler fn to rc-utils * Remove dependency of RC namespace in rc-ldap * Remove dependency of RC namespace in rc-livestream * Remove dependency of RC namespace in rc-mail-messages * Remove dependency of RC namespace in rc-mapview * Remove dependency of RC namespace in rc-mentions * Remove dependency of RC namespace in rc-mentions-flextab * Remove depedency of RC namespace in rc-message-attachements * Remove dependdency of RC namespace in rc-message-mark-as-unread * Remove dependency of RC namespace in rc-message-pin * Fix templateVarHandler that was in wrong folder * Remove namespace in the new livechat endpoint * Remove dependency of RC namespace in rc-message-snippet * Remove dependency of RC namespace in rc-message-star * Remove dependency of RC namespace in rc-oauth2 * Remove dependency of RC namespace in rc-oembed * Remove dependency of RC namespace in rc-otr * Remove dependency of RC namespace in rc-reactions * Remove dependency of RC namespace in rc-retention-policy * Remove dependency of RC namespace in rc-earch * Remove dependency of RC namespace in rc-setup-wizard * Remove dependency of RC namespace in rc-slackbridge * Remove dependency of Rc namespace in slashcommands-asciiarts * Remove depedency of RC namespace in rc-slash-archiveroom * Remove dependency of RC namespace in rc-slash-create * Remove dependency of RC namespace in rc-slash-help * Remove dependency of RC namespace in rc-slash-hide * Remove dependency of RC namespace in rc-slash-invite * Remove dependency of RC namespace in rc-slash-inviteall * Remove dependency of RC namespace in rc-slash-join * Remove dependency of RC namespace in rc-slash-kick * Remove dependency of RC namespace in rc-slash-leave * Remove dependency of RC namespace in rc-slash-me * Remove dependency of RC namespace in rc-slash-msg * Remove dependency of RC namespace in rc-slash-mute * Remove dependency of RC namespace in rc-slash-open * Remove dependency of RC namespace in rc-slash-topic * Remove dependency of RC namespace in rc-slash-unarchiveroom * Remove dependency of RC namespace in rc-smarsh-connector * Remove dependency of RC namespace in rc-sms * Remove dependency of RC namespace in rc-spotify * Remove dependency of RC namespace in rc-statistics * Move tokenpass models methods to rc-models * Remove dependency of RC namespace in rc-tokenpass * import tokenpass inside rc-lib * Remove dependency of RC namespace in rc-ui * Move webdavAccounts models to rc-model * Remove dependency of RC namespace in rc-ui-account * Remove dependency of RC namespace in rc-ui-admin * Remove dependency of RC namespace in rc-ui-clean-history * Remove dependency of RC namespace in rc-ui-flextab * Remove dependency of RC namespace in rc-ui-login * Remove dependency of RC namespace in rc-ui-master * Remove dependency of RC namespace in rc-ui-message * REmove dependency of RC namespace in rc-user-data-download * Remove dependency of RC namespace in rc-version-check * Remove dependency of RC namespace in rc-videobridge * Remove dependency of RC namespace in rc-webdav * Remove dependency of RC namespace in rc-wordpress * Remove some RC namespace use in chatpal-search * Remove dependency of RC namespace in rc-irc * Remove dependency of RC namespace in livechat/client * Move methods in common livechat models to rc-models * Remove dependency of RC namespace in rc-livechat/server/models * Remove LIvechat global variable from RC namespace * Remove dependency of RC namespace in rc-livechat/imports, lib, server/api, server/hooks and server/lib * Remove dependency of RC namespace in rc-livechat/server/methods * Fix duplicated import * Remove unused import * Remove dependency of RC namespace in rc-livechat/server/publications * Remove dependency of RC namespace in rc-api/helpers and api.js (#13273) * Move RestAPI client to rc-api package * Remove dependency of RC namespace in rc-api/helpers and api.js * Remove dependency of RC namespace on half of api files (#13275) * Move RestAPI client to rc-api package * Remove dependency of RC namespace in rc-api/helpers and api.js * Remove dependency of RC namespace on half of api files * Import missed functions in rc-irc * Partial Remove dependency of RC namespace in rc-api (#13277) * Move RestAPI client to rc-api package * Remove dependency of RC namespace in rc-api/helpers and api.js * Remove dependency of RC namespace on half of api files * Partial Remove dependency of RC namespace in rc-api * Remove dependency of RC namespace in rc-api (#13278) * Move RestAPI client to rc-api package * Remove dependency of RC namespace in rc-api/helpers and api.js * Remove dependency of RC namespace on half of api files * Partial Remove dependency of RC namespace in rc-api * import API where it was being used by the RC namespace * Move processWebhookMessage function to rc-lib package * Remove API from RC namespace and import missing function that was being used with namespace * Remove namespace in the new livechat endpoint * Remove dependency of RC namespace in rc-graphql (#13279) * Move RestAPI client to rc-api package * Remove dependency of RC namespace in rc-api/helpers and api.js * Remove dependency of RC namespace on half of api files * Partial Remove dependency of RC namespace in rc-api * import API where it was being used by the RC namespace * Move processWebhookMessage function to rc-lib package * Remove API from RC namespace and import missing function that was being used with namespace * Remove dependency of RC namespace in rc-graphql * Fix import from wrong package * Remove namespace in the new livechat endpoint * Remove dependency of RC namespace in rc-importer (#13280) * Move RestAPI client to rc-api package * Remove dependency of RC namespace in rc-api/helpers and api.js * Remove dependency of RC namespace on half of api files * Partial Remove dependency of RC namespace in rc-api * import API where it was being used by the RC namespace * Move processWebhookMessage function to rc-lib package * Remove API from RC namespace and import missing function that was being used with namespace * Remove dependency of RC namespace in rc-graphql * Fix import from wrong package * Remove dependency of RC namespace in rc-importer * Remove namespace in the new livechat endpoint * Remove dependency of RC namespace in rc-ldap, katex and issue-links (#13281) * Move RestAPI client to rc-api package * Remove dependency of RC namespace in rc-api/helpers and api.js * Remove dependency of RC namespace on half of api files * Partial Remove dependency of RC namespace in rc-api * import API where it was being used by the RC namespace * Move processWebhookMessage function to rc-lib package * Remove API from RC namespace and import missing function that was being used with namespace * Remove dependency of RC namespace in rc-graphql * Fix import from wrong package * Remove dependency of RC namespace in rc-importer * Remove dependency of RC namespace in rc-issue-links * Remove dependency of RC namespace in rc-katex * Move templateVarHandler fn to rc-utils * Remove dependency of RC namespace in rc-ldap * Fix templateVarHandler that was in wrong folder * Remove namespace in the new livechat endpoint * Remove dependency of RC namespace in rc-livestream and rc-mail-messages (#13320) * Move RestAPI client to rc-api package * Remove dependency of RC namespace in rc-api/helpers and api.js * Remove dependency of RC namespace on half of api files * Partial Remove dependency of RC namespace in rc-api * import API where it was being used by the RC namespace * Move processWebhookMessage function to rc-lib package * Remove API from RC namespace and import missing function that was being used with namespace * Remove dependency of RC namespace in rc-graphql * Fix import from wrong package * Remove dependency of RC namespace in rc-importer * Remove dependency of RC namespace in rc-issue-links * Remove dependency of RC namespace in rc-katex * Move templateVarHandler fn to rc-utils * Remove dependency of RC namespace in rc-ldap * Remove dependency of RC namespace in rc-livestream * Remove dependency of RC namespace in rc-mail-messages * Fix templateVarHandler that was in wrong folder * Remove namespace in the new livechat endpoint --- .../server/models/LivechatCustomField.js | 1 - .../server/models/LivechatOfficeHour.js | 1 - .../server/models/LivechatTrigger.js | 1 - .../server/publications/customFields.js | 4 ++-- .../server/publications/departmentAgents.js | 4 ++-- .../server/publications/livechatAgents.js | 6 +++--- .../server/publications/livechatAppearance.js | 7 ++++--- .../server/publications/livechatDepartments.js | 4 ++-- .../server/publications/livechatInquiries.js | 4 ++-- .../server/publications/livechatIntegration.js | 7 ++++--- .../server/publications/livechatManagers.js | 6 +++--- .../server/publications/livechatMonitoring.js | 7 ++++--- .../server/publications/livechatOfficeHours.js | 4 ++-- .../server/publications/livechatQueue.js | 4 ++-- .../server/publications/livechatRooms.js | 7 ++++--- .../server/publications/livechatTriggers.js | 4 ++-- .../server/publications/livechatVisitors.js | 4 ++-- .../server/publications/visitorHistory.js | 11 ++++++----- .../server/publications/visitorInfo.js | 7 ++++--- .../server/publications/visitorPageVisited.js | 9 +++++---- 20 files changed, 53 insertions(+), 49 deletions(-) diff --git a/packages/rocketchat-livechat/server/models/LivechatCustomField.js b/packages/rocketchat-livechat/server/models/LivechatCustomField.js index 27a70f6199ba..ab4a8b58192b 100644 --- a/packages/rocketchat-livechat/server/models/LivechatCustomField.js +++ b/packages/rocketchat-livechat/server/models/LivechatCustomField.js @@ -44,4 +44,3 @@ class LivechatCustomFieldClass extends Base { } export const LivechatCustomField = new LivechatCustomFieldClass(); -RocketChat.models.LivechatCustomField = LivechatCustomField; diff --git a/packages/rocketchat-livechat/server/models/LivechatOfficeHour.js b/packages/rocketchat-livechat/server/models/LivechatOfficeHour.js index 7f7b31224bc3..05a113513017 100644 --- a/packages/rocketchat-livechat/server/models/LivechatOfficeHour.js +++ b/packages/rocketchat-livechat/server/models/LivechatOfficeHour.js @@ -108,4 +108,3 @@ class LivechatOfficeHourClass extends Base { } } export const LivechatOfficeHour = new LivechatOfficeHourClass(); -RocketChat.models.LivechatOfficeHour = LivechatOfficeHour; diff --git a/packages/rocketchat-livechat/server/models/LivechatTrigger.js b/packages/rocketchat-livechat/server/models/LivechatTrigger.js index 77abc29280ea..e52734f362a2 100644 --- a/packages/rocketchat-livechat/server/models/LivechatTrigger.js +++ b/packages/rocketchat-livechat/server/models/LivechatTrigger.js @@ -29,4 +29,3 @@ class LivechatTriggerClass extends Base { } } export const LivechatTrigger = new LivechatTriggerClass(); -RocketChat.models.LivechatTrigger = LivechatTrigger; diff --git a/packages/rocketchat-livechat/server/publications/customFields.js b/packages/rocketchat-livechat/server/publications/customFields.js index 3d778d703898..616517caddb0 100644 --- a/packages/rocketchat-livechat/server/publications/customFields.js +++ b/packages/rocketchat-livechat/server/publications/customFields.js @@ -1,5 +1,5 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; import { LivechatCustomField } from '../models'; import s from 'underscore.string'; @@ -8,7 +8,7 @@ Meteor.publish('livechat:customFields', function(_id) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:customFields' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-l-room')) { + if (!hasPermission(this.userId, 'view-l-room')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:customFields' })); } diff --git a/packages/rocketchat-livechat/server/publications/departmentAgents.js b/packages/rocketchat-livechat/server/publications/departmentAgents.js index 69af2003bef6..e99e015ec09c 100644 --- a/packages/rocketchat-livechat/server/publications/departmentAgents.js +++ b/packages/rocketchat-livechat/server/publications/departmentAgents.js @@ -1,5 +1,5 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; import { LivechatDepartmentAgents } from '../models'; Meteor.publish('livechat:departmentAgents', function(departmentId) { @@ -7,7 +7,7 @@ Meteor.publish('livechat:departmentAgents', function(departmentId) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:departmentAgents' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-rooms')) { + if (!hasPermission(this.userId, 'view-livechat-rooms')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:departmentAgents' })); } diff --git a/packages/rocketchat-livechat/server/publications/livechatAgents.js b/packages/rocketchat-livechat/server/publications/livechatAgents.js index c5d333039c1f..31d026b283e6 100644 --- a/packages/rocketchat-livechat/server/publications/livechatAgents.js +++ b/packages/rocketchat-livechat/server/publications/livechatAgents.js @@ -1,18 +1,18 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission, getUsersInRole } from 'meteor/rocketchat:authorization'; Meteor.publish('livechat:agents', function() { if (!this.userId) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:agents' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-l-room')) { + if (!hasPermission(this.userId, 'view-l-room')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:agents' })); } const self = this; - const handle = RocketChat.authz.getUsersInRole('livechat-agent').observeChanges({ + const handle = getUsersInRole('livechat-agent').observeChanges({ added(id, fields) { self.added('agentUsers', id, fields); }, diff --git a/packages/rocketchat-livechat/server/publications/livechatAppearance.js b/packages/rocketchat-livechat/server/publications/livechatAppearance.js index ae46dc9797c1..2e08b44fb0bb 100644 --- a/packages/rocketchat-livechat/server/publications/livechatAppearance.js +++ b/packages/rocketchat-livechat/server/publications/livechatAppearance.js @@ -1,12 +1,13 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; +import { Settings } from 'meteor/rocketchat:models'; Meteor.publish('livechat:appearance', function() { if (!this.userId) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:appearance' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) { + if (!hasPermission(this.userId, 'view-livechat-manager')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:appearance' })); } @@ -34,7 +35,7 @@ Meteor.publish('livechat:appearance', function() { const self = this; - const handle = RocketChat.models.Settings.find(query).observeChanges({ + const handle = Settings.find(query).observeChanges({ added(id, fields) { self.added('livechatAppearance', id, fields); }, diff --git a/packages/rocketchat-livechat/server/publications/livechatDepartments.js b/packages/rocketchat-livechat/server/publications/livechatDepartments.js index dc45a31e0201..1e987bbf0f13 100644 --- a/packages/rocketchat-livechat/server/publications/livechatDepartments.js +++ b/packages/rocketchat-livechat/server/publications/livechatDepartments.js @@ -1,5 +1,5 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; import { LivechatDepartment } from '../models'; Meteor.publish('livechat:departments', function(_id) { @@ -7,7 +7,7 @@ Meteor.publish('livechat:departments', function(_id) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:agents' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-l-room')) { + if (!hasPermission(this.userId, 'view-l-room')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:agents' })); } diff --git a/packages/rocketchat-livechat/server/publications/livechatInquiries.js b/packages/rocketchat-livechat/server/publications/livechatInquiries.js index 3eb7893c13da..f1e4aaa61517 100644 --- a/packages/rocketchat-livechat/server/publications/livechatInquiries.js +++ b/packages/rocketchat-livechat/server/publications/livechatInquiries.js @@ -1,5 +1,5 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; import { LivechatInquiry } from '../../lib/LivechatInquiry'; Meteor.publish('livechat:inquiry', function() { @@ -7,7 +7,7 @@ Meteor.publish('livechat:inquiry', function() { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:inquiry' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-l-room')) { + if (!hasPermission(this.userId, 'view-l-room')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:inquiry' })); } diff --git a/packages/rocketchat-livechat/server/publications/livechatIntegration.js b/packages/rocketchat-livechat/server/publications/livechatIntegration.js index 4eaeb694e24e..521573b4b4dd 100644 --- a/packages/rocketchat-livechat/server/publications/livechatIntegration.js +++ b/packages/rocketchat-livechat/server/publications/livechatIntegration.js @@ -1,18 +1,19 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; +import { Settings } from 'meteor/rocketchat:models'; Meteor.publish('livechat:integration', function() { if (!this.userId) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:integration' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) { + if (!hasPermission(this.userId, 'view-livechat-manager')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:integration' })); } const self = this; - const handle = RocketChat.models.Settings.findByIds(['Livechat_webhookUrl', 'Livechat_secret_token', 'Livechat_webhook_on_close', 'Livechat_webhook_on_offline_msg', 'Livechat_webhook_on_visitor_message', 'Livechat_webhook_on_agent_message']).observeChanges({ + const handle = Settings.findByIds(['Livechat_webhookUrl', 'Livechat_secret_token', 'Livechat_webhook_on_close', 'Livechat_webhook_on_offline_msg', 'Livechat_webhook_on_visitor_message', 'Livechat_webhook_on_agent_message']).observeChanges({ added(id, fields) { self.added('livechatIntegration', id, fields); }, diff --git a/packages/rocketchat-livechat/server/publications/livechatManagers.js b/packages/rocketchat-livechat/server/publications/livechatManagers.js index 6f9aa3dec657..21b9070dad58 100644 --- a/packages/rocketchat-livechat/server/publications/livechatManagers.js +++ b/packages/rocketchat-livechat/server/publications/livechatManagers.js @@ -1,18 +1,18 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission, getUsersInRole } from 'meteor/rocketchat:authorization'; Meteor.publish('livechat:managers', function() { if (!this.userId) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:managers' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-rooms')) { + if (!hasPermission(this.userId, 'view-livechat-rooms')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:managers' })); } const self = this; - const handle = RocketChat.authz.getUsersInRole('livechat-manager').observeChanges({ + const handle = getUsersInRole('livechat-manager').observeChanges({ added(id, fields) { self.added('managerUsers', id, fields); }, diff --git a/packages/rocketchat-livechat/server/publications/livechatMonitoring.js b/packages/rocketchat-livechat/server/publications/livechatMonitoring.js index 99707fc23324..a120eb01aaeb 100644 --- a/packages/rocketchat-livechat/server/publications/livechatMonitoring.js +++ b/packages/rocketchat-livechat/server/publications/livechatMonitoring.js @@ -1,13 +1,14 @@ import { Meteor } from 'meteor/meteor'; import { check } from 'meteor/check'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; +import { Rooms } from 'meteor/rocketchat:models'; Meteor.publish('livechat:monitoring', function(date) { if (!this.userId) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:monitoring' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) { + if (!hasPermission(this.userId, 'view-livechat-manager')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:monitoring' })); } @@ -21,7 +22,7 @@ Meteor.publish('livechat:monitoring', function(date) { const self = this; - const handle = RocketChat.models.Rooms.getAnalyticsMetricsBetweenDate('l', date).observeChanges({ + const handle = Rooms.getAnalyticsMetricsBetweenDate('l', date).observeChanges({ added(id, fields) { self.added('livechatMonitoring', id, fields); }, diff --git a/packages/rocketchat-livechat/server/publications/livechatOfficeHours.js b/packages/rocketchat-livechat/server/publications/livechatOfficeHours.js index 754217ef3e38..da8d795f6fef 100644 --- a/packages/rocketchat-livechat/server/publications/livechatOfficeHours.js +++ b/packages/rocketchat-livechat/server/publications/livechatOfficeHours.js @@ -1,9 +1,9 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; import { LivechatOfficeHour } from '../models'; Meteor.publish('livechat:officeHour', function() { - if (!RocketChat.authz.hasPermission(this.userId, 'view-l-room')) { + if (!hasPermission(this.userId, 'view-l-room')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:agents' })); } diff --git a/packages/rocketchat-livechat/server/publications/livechatQueue.js b/packages/rocketchat-livechat/server/publications/livechatQueue.js index 94df8ba2c8fb..8230848f4600 100644 --- a/packages/rocketchat-livechat/server/publications/livechatQueue.js +++ b/packages/rocketchat-livechat/server/publications/livechatQueue.js @@ -1,5 +1,5 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; import { LivechatDepartmentAgents } from '../models'; Meteor.publish('livechat:queue', function() { @@ -7,7 +7,7 @@ Meteor.publish('livechat:queue', function() { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:queue' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-l-room')) { + if (!hasPermission(this.userId, 'view-l-room')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:queue' })); } diff --git a/packages/rocketchat-livechat/server/publications/livechatRooms.js b/packages/rocketchat-livechat/server/publications/livechatRooms.js index 0a5cb4f5354a..c0586e4dc80f 100644 --- a/packages/rocketchat-livechat/server/publications/livechatRooms.js +++ b/packages/rocketchat-livechat/server/publications/livechatRooms.js @@ -1,13 +1,14 @@ import { Meteor } from 'meteor/meteor'; import { Match, check } from 'meteor/check'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; +import { Rooms } from 'meteor/rocketchat:models'; Meteor.publish('livechat:rooms', function(filter = {}, offset = 0, limit = 20) { if (!this.userId) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:rooms' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-rooms')) { + if (!hasPermission(this.userId, 'view-livechat-rooms')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:rooms' })); } @@ -50,7 +51,7 @@ Meteor.publish('livechat:rooms', function(filter = {}, offset = 0, limit = 20) { const self = this; - const handle = RocketChat.models.Rooms.findLivechat(query, offset, limit).observeChanges({ + const handle = Rooms.findLivechat(query, offset, limit).observeChanges({ added(id, fields) { self.added('livechatRoom', id, fields); }, diff --git a/packages/rocketchat-livechat/server/publications/livechatTriggers.js b/packages/rocketchat-livechat/server/publications/livechatTriggers.js index eaf10f591d75..9d20679d5f93 100644 --- a/packages/rocketchat-livechat/server/publications/livechatTriggers.js +++ b/packages/rocketchat-livechat/server/publications/livechatTriggers.js @@ -1,5 +1,5 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; import { LivechatTrigger } from '../models'; Meteor.publish('livechat:triggers', function(_id) { @@ -7,7 +7,7 @@ Meteor.publish('livechat:triggers', function(_id) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:triggers' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) { + if (!hasPermission(this.userId, 'view-livechat-manager')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:triggers' })); } diff --git a/packages/rocketchat-livechat/server/publications/livechatVisitors.js b/packages/rocketchat-livechat/server/publications/livechatVisitors.js index b71b4888d55b..e7137ed45beb 100644 --- a/packages/rocketchat-livechat/server/publications/livechatVisitors.js +++ b/packages/rocketchat-livechat/server/publications/livechatVisitors.js @@ -1,6 +1,6 @@ import { Meteor } from 'meteor/meteor'; import { check } from 'meteor/check'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; import LivechatVisitors from '../models/LivechatVisitors'; Meteor.publish('livechat:visitors', function(date) { @@ -8,7 +8,7 @@ Meteor.publish('livechat:visitors', function(date) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:visitors' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) { + if (!hasPermission(this.userId, 'view-livechat-manager')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:visitors' })); } diff --git a/packages/rocketchat-livechat/server/publications/visitorHistory.js b/packages/rocketchat-livechat/server/publications/visitorHistory.js index 77b0405430ba..d826639bb18b 100644 --- a/packages/rocketchat-livechat/server/publications/visitorHistory.js +++ b/packages/rocketchat-livechat/server/publications/visitorHistory.js @@ -1,18 +1,19 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; +import { Rooms, Subscriptions } from 'meteor/rocketchat:models'; Meteor.publish('livechat:visitorHistory', function({ rid: roomId }) { if (!this.userId) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:visitorHistory' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-l-room')) { + if (!hasPermission(this.userId, 'view-l-room')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:visitorHistory' })); } - const room = RocketChat.models.Rooms.findOneById(roomId); + const room = Rooms.findOneById(roomId); - const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(room._id, this.userId, { fields: { _id: 1 } }); + const subscription = Subscriptions.findOneByRoomIdAndUserId(room._id, this.userId, { fields: { _id: 1 } }); if (!subscription) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:visitorHistory' })); } @@ -20,7 +21,7 @@ Meteor.publish('livechat:visitorHistory', function({ rid: roomId }) { const self = this; if (room && room.v && room.v._id) { - const handle = RocketChat.models.Rooms.findByVisitorId(room.v._id).observeChanges({ + const handle = Rooms.findByVisitorId(room.v._id).observeChanges({ added(id, fields) { self.added('visitor_history', id, fields); }, diff --git a/packages/rocketchat-livechat/server/publications/visitorInfo.js b/packages/rocketchat-livechat/server/publications/visitorInfo.js index a5ba86542cef..fafa5120ade9 100644 --- a/packages/rocketchat-livechat/server/publications/visitorInfo.js +++ b/packages/rocketchat-livechat/server/publications/visitorInfo.js @@ -1,5 +1,6 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; +import { Rooms } from 'meteor/rocketchat:models'; import LivechatVisitors from '../models/LivechatVisitors'; Meteor.publish('livechat:visitorInfo', function({ rid: roomId }) { @@ -7,11 +8,11 @@ Meteor.publish('livechat:visitorInfo', function({ rid: roomId }) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:visitorInfo' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-l-room')) { + if (!hasPermission(this.userId, 'view-l-room')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:visitorInfo' })); } - const room = RocketChat.models.Rooms.findOneById(roomId); + const room = Rooms.findOneById(roomId); if (room && room.v && room.v._id) { return LivechatVisitors.findById(room.v._id); diff --git a/packages/rocketchat-livechat/server/publications/visitorPageVisited.js b/packages/rocketchat-livechat/server/publications/visitorPageVisited.js index 039e36fcf82d..739949b266a9 100644 --- a/packages/rocketchat-livechat/server/publications/visitorPageVisited.js +++ b/packages/rocketchat-livechat/server/publications/visitorPageVisited.js @@ -1,5 +1,6 @@ import { Meteor } from 'meteor/meteor'; -import { RocketChat } from 'meteor/rocketchat:lib'; +import { hasPermission } from 'meteor/rocketchat:authorization'; +import { Rooms, Messages } from 'meteor/rocketchat:models'; Meteor.publish('livechat:visitorPageVisited', function({ rid: roomId }) { @@ -7,15 +8,15 @@ Meteor.publish('livechat:visitorPageVisited', function({ rid: roomId }) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:visitorPageVisited' })); } - if (!RocketChat.authz.hasPermission(this.userId, 'view-l-room')) { + if (!hasPermission(this.userId, 'view-l-room')) { return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:visitorPageVisited' })); } const self = this; - const room = RocketChat.models.Rooms.findOneById(roomId); + const room = Rooms.findOneById(roomId); if (room) { - const handle = RocketChat.models.Messages.findByRoomIdAndType(room._id, 'livechat_navigation_history').observeChanges({ + const handle = Messages.findByRoomIdAndType(room._id, 'livechat_navigation_history').observeChanges({ added(id, fields) { self.added('visitor_navigation_history', id, fields); },