From 1af51e550aef23ccd5a24d3a72d54dcaa7410c12 Mon Sep 17 00:00:00 2001 From: Marcos Spessatto Defendi Date: Thu, 14 Feb 2019 17:55:25 -0200 Subject: [PATCH] Remove dependency of RC namespace in rc-ui, ui-account and ui-admin (#13361) * 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-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 * 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 --- packages/rocketchat-models/client/index.js | 2 + .../client/models/WebdavAccounts.js | 3 + .../rocketchat-ui-account/client/account.js | 2 +- .../client/accountFlex.js | 15 ++-- .../client/accountIntegrations.js | 6 +- .../client/accountPreferences.js | 52 +++++++------- .../client/accountProfile.js | 48 ++++++------- .../client/avatar/prompt.js | 19 ++--- packages/rocketchat-ui-account/package.js | 6 ++ packages/rocketchat-ui-admin/client/admin.js | 69 +++++++++---------- .../rocketchat-ui-admin/client/adminFlex.js | 21 +++--- .../rocketchat-ui-admin/client/adminInfo.js | 11 +-- .../client/rooms/adminRoomInfo.js | 32 +++++---- .../client/rooms/adminRooms.js | 17 ++--- .../client/rooms/channelSettingsDefault.js | 3 +- .../client/users/adminInviteUser.js | 6 +- .../client/users/adminUsers.js | 9 ++- packages/rocketchat-ui-admin/package.js | 8 ++- .../server/publications/adminRooms.js | 11 +-- packages/rocketchat-ui/package.js | 2 + .../client/collections/WebdavAccounts.js | 4 +- 21 files changed, 187 insertions(+), 159 deletions(-) create mode 100644 packages/rocketchat-models/client/models/WebdavAccounts.js diff --git a/packages/rocketchat-models/client/index.js b/packages/rocketchat-models/client/index.js index 0185653df2e18..a990bd5fc0829 100644 --- a/packages/rocketchat-models/client/index.js +++ b/packages/rocketchat-models/client/index.js @@ -17,6 +17,7 @@ import { RoomRoles } from './models/RoomRoles'; import { UserAndRoom } from './models/UserAndRoom'; import { UserRoles } from './models/UserRoles'; import { AuthzCachedCollection, ChatPermissions } from './models/ChatPermissions'; +import { WebdavAccounts } from './models/WebdavAccounts'; import CustomSounds from './models/CustomSounds'; import EmojiCustom from './models/EmojiCustom'; import _ from 'underscore'; @@ -51,4 +52,5 @@ export { Rooms, CustomSounds, EmojiCustom, + WebdavAccounts, }; diff --git a/packages/rocketchat-models/client/models/WebdavAccounts.js b/packages/rocketchat-models/client/models/WebdavAccounts.js new file mode 100644 index 0000000000000..fafe9bf792d0e --- /dev/null +++ b/packages/rocketchat-models/client/models/WebdavAccounts.js @@ -0,0 +1,3 @@ +import { Mongo } from 'meteor/mongo'; + +export const WebdavAccounts = new Mongo.Collection('rocketchat_webdav_accounts'); diff --git a/packages/rocketchat-ui-account/client/account.js b/packages/rocketchat-ui-account/client/account.js index 5f95f6e508fd9..eb58eb9d528e3 100644 --- a/packages/rocketchat-ui-account/client/account.js +++ b/packages/rocketchat-ui-account/client/account.js @@ -1,6 +1,6 @@ import { Tracker } from 'meteor/tracker'; import { Template } from 'meteor/templating'; -import { SideNav } from 'meteor/rocketchat:ui'; +import { SideNav } from 'meteor/rocketchat:ui-utils'; Template.account.onRendered(function() { Tracker.afterFlush(function() { diff --git a/packages/rocketchat-ui-account/client/accountFlex.js b/packages/rocketchat-ui-account/client/accountFlex.js index 31d2794b9f5b3..3b0bbf5322b15 100644 --- a/packages/rocketchat-ui-account/client/accountFlex.js +++ b/packages/rocketchat-ui-account/client/accountFlex.js @@ -1,6 +1,7 @@ import { Template } from 'meteor/templating'; -import { RocketChat } from 'meteor/rocketchat:lib'; -import { SideNav } from 'meteor/rocketchat:ui'; +import { settings } from 'meteor/rocketchat:settings'; +import { hasAllPermission } from 'meteor/rocketchat:authorization'; +import { SideNav, Layout } from 'meteor/rocketchat:ui-utils'; import { t } from 'meteor/rocketchat:utils'; Template.accountFlex.events({ @@ -15,16 +16,16 @@ Template.accountFlex.events({ Template.accountFlex.helpers({ allowUserProfileChange() { - return RocketChat.settings.get('Accounts_AllowUserProfileChange'); + return settings.get('Accounts_AllowUserProfileChange'); }, accessTokensEnabled() { - return RocketChat.authz.hasAllPermission(['create-personal-access-tokens']); + return hasAllPermission(['create-personal-access-tokens']); }, encryptionEnabled() { - return RocketChat.settings.get('E2E_Enable'); + return settings.get('E2E_Enable'); }, webdavIntegrationEnabled() { - return RocketChat.settings.get('Webdav_Integration_Enabled'); + return settings.get('Webdav_Integration_Enabled'); }, menuItem(name, icon, section, group) { return { @@ -36,6 +37,6 @@ Template.accountFlex.helpers({ }; }, embeddedVersion() { - return RocketChat.Layout.isEmbedded(); + return Layout.isEmbedded(); }, }); diff --git a/packages/rocketchat-ui-account/client/accountIntegrations.js b/packages/rocketchat-ui-account/client/accountIntegrations.js index 803c84b20d48d..f7c4fc5503cce 100644 --- a/packages/rocketchat-ui-account/client/accountIntegrations.js +++ b/packages/rocketchat-ui-account/client/accountIntegrations.js @@ -1,13 +1,13 @@ import { Meteor } from 'meteor/meteor'; import { Template } from 'meteor/templating'; -import { RocketChat } from 'meteor/rocketchat:lib'; -import { modal } from 'meteor/rocketchat:ui'; +import { WebdavAccounts } from 'meteor/rocketchat:models'; +import { modal } from 'meteor/rocketchat:ui-utils'; import { t } from 'meteor/rocketchat:utils'; import toastr from 'toastr'; Template.accountIntegrations.helpers({ webdavAccounts() { - return RocketChat.models.WebdavAccounts.find().fetch(); + return WebdavAccounts.find().fetch(); }, getOptionValue(account) { return account.name || `${ account.username }@${ account.server_url.replace(/^https?\:\/\//i, '') }`; diff --git a/packages/rocketchat-ui-account/client/accountPreferences.js b/packages/rocketchat-ui-account/client/accountPreferences.js index 3343562805447..12c6d75691ee0 100644 --- a/packages/rocketchat-ui-account/client/accountPreferences.js +++ b/packages/rocketchat-ui-account/client/accountPreferences.js @@ -4,9 +4,11 @@ import { Tracker } from 'meteor/tracker'; import { Reload } from 'meteor/reload'; import { Template } from 'meteor/templating'; import { TAPi18n } from 'meteor/tap:i18n'; -import { RocketChat, handleError } from 'meteor/rocketchat:lib'; -import { modal, SideNav, KonchatNotification } from 'meteor/rocketchat:ui'; -import { t } from 'meteor/rocketchat:utils'; +import { t, handleError, getUserPreference } from 'meteor/rocketchat:utils'; +import { modal, SideNav } from 'meteor/rocketchat:ui-utils'; +import { KonchatNotification } from 'meteor/rocketchat:ui'; +import { settings } from 'meteor/rocketchat:settings'; +import { CustomSounds } from 'meteor/rocketchat:custom-sounds'; import _ from 'underscore'; import s from 'underscore.string'; import toastr from 'toastr'; @@ -26,21 +28,21 @@ function checkedSelected(property, value, defaultValue = undefined) { if (defaultValue && defaultValue.hash) { defaultValue = undefined; } - return RocketChat.getUserPreference(Meteor.userId(), property, defaultValue) === value; + return getUserPreference(Meteor.userId(), property, defaultValue) === value; } Template.accountPreferences.helpers({ audioAssets() { - return (RocketChat.CustomSounds && RocketChat.CustomSounds.getList && RocketChat.CustomSounds.getList()) || []; + return (CustomSounds && CustomSounds.getList && CustomSounds.getList()) || []; }, newMessageNotification() { - return RocketChat.getUserPreference(Meteor.userId(), 'newMessageNotification'); + return getUserPreference(Meteor.userId(), 'newMessageNotification'); }, newRoomNotification() { - return RocketChat.getUserPreference(Meteor.userId(), 'newRoomNotification'); + return getUserPreference(Meteor.userId(), 'newRoomNotification'); }, muteFocusedConversations() { - return RocketChat.getUserPreference(Meteor.userId(), 'muteFocusedConversations'); + return getUserPreference(Meteor.userId(), 'muteFocusedConversations'); }, languages() { const languages = TAPi18n.getLanguages(); @@ -68,7 +70,7 @@ Template.accountPreferences.helpers({ return checkedSelected(property, value, defaultValue); }, highlights() { - const userHighlights = RocketChat.getUserPreference(Meteor.userId(), 'highlights'); + const userHighlights = getUserPreference(Meteor.userId(), 'highlights'); return userHighlights ? userHighlights.join(',\n') : undefined; }, desktopNotificationEnabled() { @@ -78,38 +80,38 @@ Template.accountPreferences.helpers({ return KonchatNotification.notificationStatus.get() === 'denied' || (window.Notification && Notification.permission === 'denied'); }, desktopNotificationDuration() { - const userPref = RocketChat.getUserPreference(Meteor.userId(), 'desktopNotificationDuration', 'undefined'); + const userPref = getUserPreference(Meteor.userId(), 'desktopNotificationDuration', 'undefined'); return userPref !== 'undefined' ? userPref : undefined; }, defaultDesktopNotificationDuration() { - return RocketChat.settings.get('Accounts_Default_User_Preferences_desktopNotificationDuration'); + return settings.get('Accounts_Default_User_Preferences_desktopNotificationDuration'); }, idleTimeLimit() { - return RocketChat.getUserPreference(Meteor.userId(), 'idleTimeLimit'); + return getUserPreference(Meteor.userId(), 'idleTimeLimit'); }, defaultIdleTimeLimit() { - return RocketChat.settings.get('Accounts_Default_User_Preferences_idleTimeLimit'); + return settings.get('Accounts_Default_User_Preferences_idleTimeLimit'); }, defaultDesktopNotification() { - return notificationLabels[RocketChat.settings.get('Accounts_Default_User_Preferences_desktopNotifications')]; + return notificationLabels[settings.get('Accounts_Default_User_Preferences_desktopNotifications')]; }, defaultMobileNotification() { - return notificationLabels[RocketChat.settings.get('Accounts_Default_User_Preferences_mobileNotifications')]; + return notificationLabels[settings.get('Accounts_Default_User_Preferences_mobileNotifications')]; }, defaultEmailNotification() { - return emailLabels[RocketChat.settings.get('Accounts_Default_User_Preferences_emailNotificationMode')]; + return emailLabels[settings.get('Accounts_Default_User_Preferences_emailNotificationMode')]; }, showRoles() { - return RocketChat.settings.get('UI_DisplayRoles'); + return settings.get('UI_DisplayRoles'); }, userDataDownloadEnabled() { - return RocketChat.settings.get('UserData_EnableDownload') !== false; + return settings.get('UserData_EnableDownload') !== false; }, notificationsSoundVolume() { - return RocketChat.getUserPreference(Meteor.userId(), 'notificationsSoundVolume'); + return getUserPreference(Meteor.userId(), 'notificationsSoundVolume'); }, dontAskAgainList() { - return RocketChat.getUserPreference(Meteor.userId(), 'dontAskAgainList'); + return getUserPreference(Meteor.userId(), 'dontAskAgainList'); }, }); @@ -122,7 +124,7 @@ Template.accountPreferences.onCreated(function() { settingsTemplate.child.push(this); - this.useEmojis = new ReactiveVar(RocketChat.getUserPreference(Meteor.userId(), 'useEmojis')); + this.useEmojis = new ReactiveVar(getUserPreference(Meteor.userId(), 'useEmojis')); let instance = this; @@ -161,7 +163,7 @@ Template.accountPreferences.onCreated(function() { data.sendOnEnter = $('#sendOnEnter').find('select').val(); data.autoImageLoad = JSON.parse($('input[name=autoImageLoad]:checked').val()); data.emailNotificationMode = $('select[name=emailNotificationMode]').val(); - data.desktopNotificationDuration = $('input[name=desktopNotificationDuration]').val() === '' ? RocketChat.settings.get('Accounts_Default_User_Preferences_desktopNotificationDuration') : parseInt($('input[name=desktopNotificationDuration]').val()); + data.desktopNotificationDuration = $('input[name=desktopNotificationDuration]').val() === '' ? settings.get('Accounts_Default_User_Preferences_desktopNotificationDuration') : parseInt($('input[name=desktopNotificationDuration]').val()); data.desktopNotifications = $('#desktopNotifications').find('select').val(); data.mobileNotifications = $('#mobileNotifications').find('select').val(); data.unreadAlert = JSON.parse($('#unreadAlert').find('input:checked').val()); @@ -174,12 +176,12 @@ Template.accountPreferences.onCreated(function() { let reload = false; - if (RocketChat.settings.get('UI_DisplayRoles')) { + if (settings.get('UI_DisplayRoles')) { data.hideRoles = JSON.parse($('#hideRoles').find('input:checked').val()); } // if highlights changed we need page reload - const highlights = RocketChat.getUserPreference(Meteor.userId(), 'highlights'); + const highlights = getUserPreference(Meteor.userId(), 'highlights'); if (highlights && highlights.join('\n') !== data.highlights.join('\n')) { reload = true; } @@ -198,7 +200,7 @@ Template.accountPreferences.onCreated(function() { reload = true; } - const idleTimeLimit = $('input[name=idleTimeLimit]').val() === '' ? RocketChat.settings.get('Accounts_Default_User_Preferences_idleTimeLimit') : parseInt($('input[name=idleTimeLimit]').val()); + const idleTimeLimit = $('input[name=idleTimeLimit]').val() === '' ? settings.get('Accounts_Default_User_Preferences_idleTimeLimit') : parseInt($('input[name=idleTimeLimit]').val()); data.idleTimeLimit = idleTimeLimit; if (this.shouldUpdateLocalStorageSetting('idleTimeLimit', idleTimeLimit)) { localStorage.setItem('idleTimeLimit', idleTimeLimit); diff --git a/packages/rocketchat-ui-account/client/accountProfile.js b/packages/rocketchat-ui-account/client/accountProfile.js index ddb1ea964b3c7..d189dff7f22f2 100644 --- a/packages/rocketchat-ui-account/client/accountProfile.js +++ b/packages/rocketchat-ui-account/client/accountProfile.js @@ -4,16 +4,18 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; import { FlowRouter } from 'meteor/kadira:flow-router'; import { Template } from 'meteor/templating'; -import { RocketChat, handleError } from 'meteor/rocketchat:lib'; -import { modal, SideNav } from 'meteor/rocketchat:ui'; -import { t } from 'meteor/rocketchat:utils'; +import { modal, SideNav } from 'meteor/rocketchat:ui-utils'; +import { t, handleError } from 'meteor/rocketchat:utils'; +import { settings } from 'meteor/rocketchat:settings'; +import { Notifications } from 'meteor/rocketchat:notifications'; +import { callbacks } from 'meteor/rocketchat:callbacks'; import _ from 'underscore'; import s from 'underscore.string'; import toastr from 'toastr'; const validateEmail = (email) => /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(email); const validateUsername = (username) => { - const reg = new RegExp(`^${ RocketChat.settings.get('UTF8_Names_Validation') }$`); + const reg = new RegExp(`^${ settings.get('UTF8_Names_Validation') }$`); return reg.test(username); }; const validateName = (name) => name && name.length; @@ -26,7 +28,7 @@ const validatePassword = (password, confirmationPassword) => { }; const filterNames = (old) => { - const reg = new RegExp(`^${ RocketChat.settings.get('UTF8_Names_Validation') }$`); + const reg = new RegExp(`^${ settings.get('UTF8_Names_Validation') }$`); return [...old.replace(' ', '')].filter((f) => reg.test(f)).join(''); }; const filterEmail = (old) => old.replace(' ', ''); @@ -83,7 +85,7 @@ Template.accountProfile.helpers({ return Object.keys(suggestions.avatars).map((service) => ({ name: service, // TODO: improve this fix - service: !suggestions.avatars[service.toLowerCase()] ? RocketChat.settings.get(`Accounts_OAuth_${ s.capitalize(service.toLowerCase()) }`) : false, + service: !suggestions.avatars[service.toLowerCase()] ? settings.get(`Accounts_OAuth_${ s.capitalize(service.toLowerCase()) }`) : false, suggestion: suggestions.avatars[service.toLowerCase()], })) .filter(({ service, suggestion }) => service || suggestion); @@ -133,7 +135,7 @@ Template.accountProfile.helpers({ return; }, allowDeleteOwnAccount() { - return RocketChat.settings.get('Accounts_AllowDeleteOwnAccount'); + return settings.get('Accounts_AllowDeleteOwnAccount'); }, realname() { return Meteor.user().name; @@ -150,23 +152,23 @@ Template.accountProfile.helpers({ return isUserEmailVerified(user); }, allowRealNameChange() { - return RocketChat.settings.get('Accounts_AllowRealNameChange'); + return settings.get('Accounts_AllowRealNameChange'); }, allowUsernameChange() { - return RocketChat.settings.get('Accounts_AllowUsernameChange') && RocketChat.settings.get('LDAP_Enable') !== true; + return settings.get('Accounts_AllowUsernameChange') && settings.get('LDAP_Enable') !== true; }, allowEmailChange() { - return RocketChat.settings.get('Accounts_AllowEmailChange'); + return settings.get('Accounts_AllowEmailChange'); }, allowPasswordChange() { - return RocketChat.settings.get('Accounts_AllowPasswordChange'); + return settings.get('Accounts_AllowPasswordChange'); }, canConfirmNewPassword() { const password = Template.instance().password.get(); - return RocketChat.settings.get('Accounts_AllowPasswordChange') && password && password !== ''; + return settings.get('Accounts_AllowPasswordChange') && password && password !== ''; }, allowAvatarChange() { - return RocketChat.settings.get('Accounts_AllowUserAvatarChange'); + return settings.get('Accounts_AllowUserAvatarChange'); }, customFields() { return Meteor.user().customFields; @@ -187,7 +189,7 @@ Template.accountProfile.onCreated(function() { self.url = new ReactiveVar(''); self.usernameAvaliable = new ReactiveVar(true); - RocketChat.Notifications.onLogged('updateAvatar', () => self.avatar.set()); + Notifications.onLogged('updateAvatar', () => self.avatar.set()); self.getSuggestions = function() { self.suggestions.set(undefined); Meteor.call('getAvatarSuggestion', function(error, avatars) { @@ -207,7 +209,7 @@ Template.accountProfile.onCreated(function() { const instance = this; if (!newPassword) { return callback(); - } else if (!RocketChat.settings.get('Accounts_AllowPasswordChange')) { + } else if (!settings.get('Accounts_AllowPasswordChange')) { toastr.remove(); toastr.error(t('Password_Change_Disabled')); instance.clearForm(); @@ -229,7 +231,7 @@ Template.accountProfile.onCreated(function() { })); } else { toastr.success(t('Avatar_changed_successfully')); - RocketChat.callbacks.run('userAvatarSet', avatar.service); + callbacks.run('userAvatarSet', avatar.service); } }); } @@ -239,11 +241,11 @@ Template.accountProfile.onCreated(function() { if (typedPassword) { data.typedPassword = typedPassword; } - if (s.trim(self.password.get()) && RocketChat.settings.get('Accounts_AllowPasswordChange')) { + if (s.trim(self.password.get()) && settings.get('Accounts_AllowPasswordChange')) { data.newPassword = self.password.get(); } if (s.trim(self.realname.get()) !== user.name) { - if (!RocketChat.settings.get('Accounts_AllowRealNameChange')) { + if (!settings.get('Accounts_AllowRealNameChange')) { toastr.remove(); toastr.error(t('RealName_Change_Disabled')); instance.clearForm(); @@ -253,7 +255,7 @@ Template.accountProfile.onCreated(function() { } } if (s.trim(self.username.get()) !== user.username) { - if (!RocketChat.settings.get('Accounts_AllowUsernameChange')) { + if (!settings.get('Accounts_AllowUsernameChange')) { toastr.remove(); toastr.error(t('Username_Change_Disabled')); instance.clearForm(); @@ -263,7 +265,7 @@ Template.accountProfile.onCreated(function() { } } if (s.trim(self.email.get()) !== getUserEmailAddress(user)) { - if (!RocketChat.settings.get('Accounts_AllowEmailChange')) { + if (!settings.get('Accounts_AllowEmailChange')) { toastr.remove(); toastr.error(t('Email_Change_Disabled')); instance.clearForm(); @@ -299,7 +301,7 @@ Template.accountProfile.onCreated(function() { Template.accountProfile.onRendered(function() { Tracker.afterFlush(() => { - if (!RocketChat.settings.get('Accounts_AllowUserProfileChange')) { + if (!settings.get('Accounts_AllowUserProfileChange')) { FlowRouter.go('home'); } this.clearForm(); @@ -326,7 +328,7 @@ Template.accountProfile.events({ })); } else { toastr.success(t('Avatar_changed_successfully')); - RocketChat.callbacks.run('userAvatarSet', 'initials'); + callbacks.run('userAvatarSet', 'initials'); } }); }, @@ -527,7 +529,7 @@ Template.accountProfile.events({ contentType: blob.type, blob: reader.result, }); - RocketChat.callbacks.run('userAvatarSet', 'upload'); + callbacks.run('userAvatarSet', 'upload'); }; }); }, diff --git a/packages/rocketchat-ui-account/client/avatar/prompt.js b/packages/rocketchat-ui-account/client/avatar/prompt.js index db53a5a25a11b..3089651357c91 100644 --- a/packages/rocketchat-ui-account/client/avatar/prompt.js +++ b/packages/rocketchat-ui-account/client/avatar/prompt.js @@ -3,8 +3,9 @@ import { ReactiveVar } from 'meteor/reactive-var'; import { Tracker } from 'meteor/tracker'; import { FlowRouter } from 'meteor/kadira:flow-router'; import { Template } from 'meteor/templating'; -import { RocketChat } from 'meteor/rocketchat:lib'; -import { SideNav } from 'meteor/rocketchat:ui'; +import { settings } from 'meteor/rocketchat:settings'; +import { callbacks } from 'meteor/rocketchat:callbacks'; +import { SideNav } from 'meteor/rocketchat:ui-utils'; import { t } from 'meteor/rocketchat:utils'; import { fileUploadHandler } from 'meteor/rocketchat:file-upload'; import s from 'underscore.string'; @@ -26,7 +27,7 @@ Template.avatarPrompt.onCreated(function() { Template.avatarPrompt.onRendered(function() { Tracker.afterFlush(function() { - if (!RocketChat.settings.get('Accounts_AllowUserAvatarChange')) { + if (!settings.get('Accounts_AllowUserAvatarChange')) { FlowRouter.go('home'); } SideNav.setFlex('accountFlex'); @@ -40,7 +41,7 @@ Template.avatarPrompt.helpers({ }, suggestAvatar(service) { const suggestions = Template.instance().suggestions.get(); - return RocketChat.settings.get(`Accounts_OAuth_${ s.capitalize(service) }`) && !suggestions.avatars[service]; + return settings.get(`Accounts_OAuth_${ s.capitalize(service) }`) && !suggestions.avatars[service]; }, upload() { return Template.instance().upload.get(); @@ -65,7 +66,7 @@ Template.avatarPrompt.events({ })); } else { toastr.success(t('Avatar_changed_successfully')); - RocketChat.callbacks.run('userAvatarSet', 'initials'); + callbacks.run('userAvatarSet', 'initials'); } }); } else if (this.service === 'url') { @@ -81,7 +82,7 @@ Template.avatarPrompt.events({ } } else { toastr.success(t('Avatar_changed_successfully')); - RocketChat.callbacks.run('userAvatarSet', 'url'); + callbacks.run('userAvatarSet', 'url'); } }); } else { @@ -113,7 +114,7 @@ Template.avatarPrompt.events({ upload.start((error, result) => { if (result) { toastr.success(t('Avatar_changed_successfully')); - RocketChat.callbacks.run('userAvatarSet', this.service); + callbacks.run('userAvatarSet', this.service); } }); } else { @@ -125,7 +126,7 @@ Template.avatarPrompt.events({ })); } else { toastr.success(t('Avatar_changed_successfully')); - RocketChat.callbacks.run('userAvatarSet', tmpService); + callbacks.run('userAvatarSet', tmpService); } }); } @@ -163,7 +164,7 @@ Template.avatarPrompt.events({ contentType: blob.type, blob: reader.result, }); - RocketChat.callbacks.run('userAvatarSet', 'upload'); + callbacks.run('userAvatarSet', 'upload'); }; }); }, diff --git a/packages/rocketchat-ui-account/package.js b/packages/rocketchat-ui-account/package.js index 082dece03b282..822204bc47ea9 100644 --- a/packages/rocketchat-ui-account/package.js +++ b/packages/rocketchat-ui-account/package.js @@ -17,6 +17,12 @@ Package.onUse(function(api) { 'rocketchat:lib', 'sha', 'rocketchat:utils', + 'rocketchat:custom-sounds', + 'rocketchat:authorization', + 'rocketchat:settings', + 'rocketchat:notifications', + 'rocketchat:callbacks', + 'rocketchat:ui-utils', 'rocketchat:lazy-load', 'rocketchat:file-upload', ]); diff --git a/packages/rocketchat-ui-admin/client/admin.js b/packages/rocketchat-ui-admin/client/admin.js index c5f17ab6d0667..b9210bc0319f4 100644 --- a/packages/rocketchat-ui-admin/client/admin.js +++ b/packages/rocketchat-ui-admin/client/admin.js @@ -6,19 +6,18 @@ import { Tracker } from 'meteor/tracker'; import { FlowRouter } from 'meteor/kadira:flow-router'; import { Template } from 'meteor/templating'; import { TAPi18n } from 'meteor/tap:i18n'; -import { RocketChat, handleError } from 'meteor/rocketchat:lib'; -import { SideNav, modal } from 'meteor/rocketchat:ui'; -import { t } from 'meteor/rocketchat:utils'; +import { settings } from 'meteor/rocketchat:settings'; +import { SideNav, modal } from 'meteor/rocketchat:ui-utils'; +import { t, handleError } from 'meteor/rocketchat:utils'; +import { CachedCollection } from 'meteor/rocketchat:ui-cached-collection'; import _ from 'underscore'; import s from 'underscore.string'; import toastr from 'toastr'; const TempSettings = new Mongo.Collection(null); -RocketChat.TempSettings = TempSettings; - const getDefaultSetting = function(settingId) { - return RocketChat.settings.collectionPrivate.findOne({ + return settings.collectionPrivate.findOne({ _id: settingId, }); }; @@ -41,7 +40,7 @@ const setFieldValue = function(settingId, value, type, editor) { const selectedRooms = Template.instance().selectedRooms.get(); selectedRooms[settingId] = value; Template.instance().selectedRooms.set(selectedRooms); - TempSettings.update({ _id: settingId }, { $set: { value, changed: JSON.stringify(RocketChat.settings.collectionPrivate.findOne(settingId).value) !== JSON.stringify(value) } }); + TempSettings.update({ _id: settingId }, { $set: { value, changed: JSON.stringify(settings.collectionPrivate.findOne(settingId).value) !== JSON.stringify(value) } }); break; default: input.val(value).change(); @@ -49,17 +48,17 @@ const setFieldValue = function(settingId, value, type, editor) { }; Template.admin.onCreated(function() { - if (RocketChat.settings.cachedCollectionPrivate == null) { - RocketChat.settings.cachedCollectionPrivate = new RocketChat.CachedCollection({ + if (settings.cachedCollectionPrivate == null) { + settings.cachedCollectionPrivate = new CachedCollection({ name: 'private-settings', eventType: 'onLogged', useCache: false, }); - RocketChat.settings.collectionPrivate = RocketChat.settings.cachedCollectionPrivate.collection; - RocketChat.settings.cachedCollectionPrivate.init(); + settings.collectionPrivate = settings.cachedCollectionPrivate.collection; + settings.cachedCollectionPrivate.init(); } this.selectedRooms = new ReactiveVar({}); - RocketChat.settings.collectionPrivate.find().observe({ + settings.collectionPrivate.find().observe({ added: (data) => { const selectedRooms = this.selectedRooms.get(); if (data.type === 'roomPick') { @@ -108,23 +107,23 @@ Template.admin.helpers({ return result; }, isAppLanguage(key) { - const languageKey = RocketChat.settings.get('Language'); + const languageKey = settings.get('Language'); return typeof languageKey === 'string' && languageKey.toLowerCase() === key; }, group() { const groupId = FlowRouter.getParam('group'); - const group = RocketChat.settings.collectionPrivate.findOne({ + const group = settings.collectionPrivate.findOne({ _id: groupId, type: 'group', }); if (!group) { return; } - const settings = RocketChat.settings.collectionPrivate.find({ group: groupId }, { sort: { section: 1, sorter: 1, i18nLabel: 1 } }).fetch(); + const rcSettings = settings.collectionPrivate.find({ group: groupId }, { sort: { section: 1, sorter: 1, i18nLabel: 1 } }).fetch(); const sections = {}; - Object.keys(settings).forEach((key) => { - const setting = settings[key]; + Object.keys(rcSettings).forEach((key) => { + const setting = rcSettings[key]; let i18nDefaultQuery; if (setting.i18nDefaultQuery != null) { if (_.isString(setting.i18nDefaultQuery)) { @@ -137,7 +136,7 @@ Template.admin.helpers({ } Object.keys(i18nDefaultQuery).forEach((key) => { const item = i18nDefaultQuery[key]; - if (RocketChat.settings.collectionPrivate.findOne(item) != null) { + if (settings.collectionPrivate.findOne(item) != null) { setting.value = TAPi18n.__(`${ setting._id }_Default`); } }); @@ -273,7 +272,7 @@ Template.admin.helpers({ return Meteor.absoluteUrl(url); }, selectedOption(_id, val) { - const option = RocketChat.settings.collectionPrivate.findOne({ _id }); + const option = settings.collectionPrivate.findOne({ _id }); return option && option.value === val; }, random() { @@ -304,7 +303,7 @@ Template.admin.helpers({ } const onChange = function() { const value = codeMirror.getValue(); - TempSettings.update({ _id }, { $set: { value, changed: RocketChat.settings.collectionPrivate.findOne(_id).value !== value } }); + TempSettings.update({ _id }, { $set: { value, changed: settings.collectionPrivate.findOne(_id).value !== value } }); }; const onChangeDelayed = _.debounce(onChange, 500); codeMirror.on('change', onChangeDelayed); @@ -369,14 +368,14 @@ Template.admin.events({ }, { $set: { value, - changed: RocketChat.settings.collectionPrivate.findOne(this._id).value !== value, + changed: settings.collectionPrivate.findOne(this._id).value !== value, }, }); }, 500), 'change select[name=color-editor]'(e) { const value = s.trim($(e.target).val()); TempSettings.update({ _id: this._id }, { $set: { editor: value } }); - RocketChat.settings.collectionPrivate.update({ _id: this._id }, { $set: { editor: value } }); + settings.collectionPrivate.update({ _id: this._id }, { $set: { editor: value } }); }, 'click .rc-header__section-button .discard'() { const group = FlowRouter.getParam('group'); @@ -384,10 +383,10 @@ Template.admin.events({ group, changed: true, }; - const settings = TempSettings.find(query, { + const rcSettings = TempSettings.find(query, { fields: { _id: 1, value: 1, packageValue: 1 } }).fetch(); - settings.forEach(function(setting) { - const oldSetting = RocketChat.settings.collectionPrivate.findOne({ _id: setting._id }, { fields: { value: 1, type: 1, editor: 1 } }); + rcSettings.forEach(function(setting) { + const oldSetting = settings.collectionPrivate.findOne({ _id: setting._id }, { fields: { value: 1, type: 1, editor: 1 } }); setFieldValue(setting._id, oldSetting.value, oldSetting.type, oldSetting.editor); }); }, @@ -401,22 +400,22 @@ Template.admin.events({ setFieldValue(settingId, defaultValue.packageValue, defaultValue.type, defaultValue.editor); }, 'click .reset-group'(e) { - let settings; + let rcSettings; e.preventDefault(); const group = FlowRouter.getParam('group'); const section = $(e.target).data('section'); if (section === '') { - settings = TempSettings.find({ group, section: { $exists: false } }, { fields: { _id: 1 } }).fetch(); + rcSettings = TempSettings.find({ group, section: { $exists: false } }, { fields: { _id: 1 } }).fetch(); } else { - settings = TempSettings.find({ group, section }, { fields: { _id: 1 } }).fetch(); + rcSettings = TempSettings.find({ group, section }, { fields: { _id: 1 } }).fetch(); } - settings.forEach(function(setting) { + rcSettings.forEach(function(setting) { const defaultValue = getDefaultSetting(setting._id); setFieldValue(setting._id, defaultValue.packageValue, defaultValue.type, defaultValue.editor); TempSettings.update({ _id: setting._id }, { $set: { value: defaultValue.packageValue, - changed: RocketChat.settings.collectionPrivate.findOne(setting._id).value !== defaultValue.packageValue, + changed: settings.collectionPrivate.findOne(setting._id).value !== defaultValue.packageValue, }, }); }); @@ -424,21 +423,21 @@ Template.admin.events({ 'click .rc-header__section-button .save'() { const group = FlowRouter.getParam('group'); const query = { group, changed: true }; - const settings = TempSettings.find(query, { fields: { _id: 1, value: 1, editor: 1 } }).fetch() || []; - if (settings.length === 0) { + const rcSettings = TempSettings.find(query, { fields: { _id: 1, value: 1, editor: 1 } }).fetch() || []; + if (rcSettings.length === 0) { return; } - RocketChat.settings.batchSet(settings, (err) => { + settings.batchSet(rcSettings, (err) => { if (err) { return handleError(err); } TempSettings.update({ changed: true }, { $unset: { changed: 1 } }); - if (settings.some(({ _id }) => _id === 'Language')) { + if (rcSettings.some(({ _id }) => _id === 'Language')) { const lng = Meteor.user().language - || settings.filter(({ _id }) => _id === 'Language').shift().value + || rcSettings.filter(({ _id }) => _id === 'Language').shift().value || 'en'; return TAPi18n._loadLanguage(lng).then(() => toastr.success(TAPi18n.__('Settings_updated', { lng }))); } diff --git a/packages/rocketchat-ui-admin/client/adminFlex.js b/packages/rocketchat-ui-admin/client/adminFlex.js index 06830633eee39..e05a458245f83 100644 --- a/packages/rocketchat-ui-admin/client/adminFlex.js +++ b/packages/rocketchat-ui-admin/client/adminFlex.js @@ -1,22 +1,23 @@ import { ReactiveVar } from 'meteor/reactive-var'; import { Template } from 'meteor/templating'; import { TAPi18n } from 'meteor/tap:i18n'; -import { RocketChat } from 'meteor/rocketchat:lib'; -import { SideNav } from 'meteor/rocketchat:ui'; +import { settings } from 'meteor/rocketchat:settings'; +import { CachedCollection } from 'meteor/rocketchat:ui-cached-collection'; +import { SideNav, AdminBox, Layout } from 'meteor/rocketchat:ui-utils'; import { t } from 'meteor/rocketchat:utils'; import _ from 'underscore'; import s from 'underscore.string'; Template.adminFlex.onCreated(function() { this.settingsFilter = new ReactiveVar(''); - if (RocketChat.settings.cachedCollectionPrivate == null) { - RocketChat.settings.cachedCollectionPrivate = new RocketChat.CachedCollection({ + if (settings.cachedCollectionPrivate == null) { + settings.cachedCollectionPrivate = new CachedCollection({ name: 'private-settings', eventType: 'onLogged', useCache: false, }); - RocketChat.settings.collectionPrivate = RocketChat.settings.cachedCollectionPrivate.collection; - RocketChat.settings.cachedCollectionPrivate.init(); + settings.collectionPrivate = settings.cachedCollectionPrivate.collection; + settings.cachedCollectionPrivate.init(); } }); @@ -36,7 +37,7 @@ Template.adminFlex.helpers({ }; if (filter) { const filterRegex = new RegExp(s.escapeRegExp(filter), 'i'); - const records = RocketChat.settings.collectionPrivate.find().fetch(); + const records = settings.collectionPrivate.find().fetch(); let groups = []; records.forEach(function(record) { if (filterRegex.test(TAPi18n.__(record.i18nLabel || record._id))) { @@ -50,7 +51,7 @@ Template.adminFlex.helpers({ }; } } - return RocketChat.settings.collectionPrivate.find(query).fetch().map(function(el) { + return settings.collectionPrivate.find(query).fetch().map(function(el) { el.label = label.apply(el); return el; }).sort(function(a, b) { @@ -63,7 +64,7 @@ Template.adminFlex.helpers({ }, label, adminBoxOptions() { - return RocketChat.AdminBox.getOptions(); + return AdminBox.getOptions(); }, menuItem(name, icon, section, group) { return { @@ -76,7 +77,7 @@ Template.adminFlex.helpers({ }; }, embeddedVersion() { - return RocketChat.Layout.isEmbedded(); + return Layout.isEmbedded(); }, }); diff --git a/packages/rocketchat-ui-admin/client/adminInfo.js b/packages/rocketchat-ui-admin/client/adminInfo.js index 235a461a60776..8791d3197fa94 100644 --- a/packages/rocketchat-ui-admin/client/adminInfo.js +++ b/packages/rocketchat-ui-admin/client/adminInfo.js @@ -3,8 +3,9 @@ import { ReactiveVar } from 'meteor/reactive-var'; import { Tracker } from 'meteor/tracker'; import { Template } from 'meteor/templating'; import { TAPi18n } from 'meteor/tap:i18n'; -import { RocketChat, handleError } from 'meteor/rocketchat:lib'; -import { SideNav } from 'meteor/rocketchat:ui'; +import { handleError, Info } from 'meteor/rocketchat:utils'; +import { hasAllPermission } from 'meteor/rocketchat:authorization'; +import { SideNav } from 'meteor/rocketchat:ui-utils'; import s from 'underscore.string'; import moment from 'moment'; @@ -53,10 +54,10 @@ Template.adminInfo.helpers({ return s.numberFormat(number, 2); }, info() { - return RocketChat.Info; + return Info; }, build() { - return RocketChat.Info && (RocketChat.Info.compile || RocketChat.Info.build); + return Info && (Info.compile || Info.build); }, }); @@ -86,7 +87,7 @@ Template.adminInfo.onCreated(function() { this.statistics = new ReactiveVar({}); this.instances = new ReactiveVar({}); this.ready = new ReactiveVar(false); - if (RocketChat.authz.hasAllPermission('view-statistics')) { + if (hasAllPermission('view-statistics')) { Meteor.call('getStatistics', function(error, statistics) { instance.ready.set(true); if (error) { diff --git a/packages/rocketchat-ui-admin/client/rooms/adminRoomInfo.js b/packages/rocketchat-ui-admin/client/rooms/adminRoomInfo.js index ec8d61ca028e3..c5a8c1bd0ec9f 100644 --- a/packages/rocketchat-ui-admin/client/rooms/adminRoomInfo.js +++ b/packages/rocketchat-ui-admin/client/rooms/adminRoomInfo.js @@ -3,10 +3,12 @@ import { ReactiveVar } from 'meteor/reactive-var'; import { Session } from 'meteor/session'; import { Template } from 'meteor/templating'; import { TAPi18n } from 'meteor/tap:i18n'; -import { RocketChat, handleError } from 'meteor/rocketchat:lib'; -import { modal } from 'meteor/rocketchat:ui'; -import { t } from 'meteor/rocketchat:utils'; -import { call } from 'meteor/rocketchat:ui-utils'; +import { t, handleError } from 'meteor/rocketchat:utils'; +import { call, modal } from 'meteor/rocketchat:ui-utils'; +import { hasAllPermission, hasAtLeastOnePermission } from 'meteor/rocketchat:authorization'; +import { ChannelSettings } from 'meteor/rocketchat:channel-settings'; +import { settings } from 'meteor/rocketchat:settings'; +import { callbacks } from 'meteor/rocketchat:callbacks'; import { AdminChatRoom } from './adminRooms'; import toastr from 'toastr'; @@ -15,7 +17,7 @@ Template.adminRoomInfo.helpers({ return Session.get('adminRoomsSelected'); }, canEdit() { - return RocketChat.authz.hasAllPermission('edit-room', this.rid); + return hasAllPermission('edit-room', this.rid); }, editing(field) { return Template.instance().editing.get() === field; @@ -29,7 +31,7 @@ Template.adminRoomInfo.helpers({ return room && room.t; }, channelSettings() { - return RocketChat.ChannelSettings.getOptions(undefined, 'admin-room'); + return ChannelSettings.getOptions(undefined, 'admin-room'); }, roomTypeDescription() { const room = AdminChatRoom.findOne(this.rid, { fields: { t: 1 } }); @@ -68,7 +70,7 @@ Template.adminRoomInfo.helpers({ canDeleteRoom() { const room = AdminChatRoom.findOne(this.rid, { fields: { t: 1 } }); const roomType = room && room.t; - return (roomType != null) && RocketChat.authz.hasAtLeastOnePermission(`delete-${ roomType }`); + return (roomType != null) && hasAtLeastOnePermission(`delete-${ roomType }`); }, readOnly() { const room = AdminChatRoom.findOne(this.rid, { fields: { ro: 1 } }); @@ -150,13 +152,13 @@ Template.adminRoomInfo.onCreated(function() { this.validateRoomName = (rid) => { const room = AdminChatRoom.findOne(rid); let nameValidation; - if (!RocketChat.authz.hasAllPermission('edit-room', rid) || (room.t !== 'c' && room.t !== 'p')) { + if (!hasAllPermission('edit-room', rid) || (room.t !== 'c' && room.t !== 'p')) { toastr.error(t('error-not-allowed')); return false; } name = $('input[name=roomName]').val(); try { - nameValidation = new RegExp(`^${ RocketChat.settings.get('UTF8_Names_Validation') }$`); + nameValidation = new RegExp(`^${ settings.get('UTF8_Names_Validation') }$`); } catch (_error) { nameValidation = new RegExp('^[0-9a-zA-Z-_.]+$'); } @@ -173,7 +175,7 @@ Template.adminRoomInfo.onCreated(function() { switch (this.editing.get()) { case 'roomName': if (this.validateRoomName(rid)) { - RocketChat.callbacks.run('roomNameChanged', AdminChatRoom.findOne(rid)); + callbacks.run('roomNameChanged', AdminChatRoom.findOne(rid)); Meteor.call('saveRoomSettings', rid, 'roomName', this.$('input[name=roomName]').val(), function(err) { if (err) { return handleError(err); @@ -189,7 +191,7 @@ Template.adminRoomInfo.onCreated(function() { return handleError(err); } toastr.success(TAPi18n.__('Room_topic_changed_successfully')); - RocketChat.callbacks.run('roomTopicChanged', AdminChatRoom.findOne(rid)); + callbacks.run('roomTopicChanged', AdminChatRoom.findOne(rid)); }); } break; @@ -200,14 +202,14 @@ Template.adminRoomInfo.onCreated(function() { return handleError(err); } toastr.success(TAPi18n.__('Room_announcement_changed_successfully')); - RocketChat.callbacks.run('roomAnnouncementChanged', AdminChatRoom.findOne(rid)); + callbacks.run('roomAnnouncementChanged', AdminChatRoom.findOne(rid)); }); } break; case 'roomType': const val = this.$('input[name=roomType]:checked').val(); if (this.validateRoomType(rid)) { - RocketChat.callbacks.run('roomTypeChanged', AdminChatRoom.findOne(rid)); + callbacks.run('roomTypeChanged', AdminChatRoom.findOne(rid)); const saveRoomSettings = function() { Meteor.call('saveRoomSettings', rid, 'roomType', val, function(err) { if (err) { @@ -243,7 +245,7 @@ Template.adminRoomInfo.onCreated(function() { return handleError(err); } toastr.success(TAPi18n.__('Room_archived')); - RocketChat.callbacks.run('archiveRoom', AdminChatRoom.findOne(rid)); + callbacks.run('archiveRoom', AdminChatRoom.findOne(rid)); }); } } else if ((room && room.archived) === true) { @@ -252,7 +254,7 @@ Template.adminRoomInfo.onCreated(function() { return handleError(err); } toastr.success(TAPi18n.__('Room_unarchived')); - RocketChat.callbacks.run('unarchiveRoom', AdminChatRoom.findOne(rid)); + callbacks.run('unarchiveRoom', AdminChatRoom.findOne(rid)); }); } break; diff --git a/packages/rocketchat-ui-admin/client/rooms/adminRooms.js b/packages/rocketchat-ui-admin/client/rooms/adminRooms.js index 4b3d7e9695209..22bf2e40b6725 100644 --- a/packages/rocketchat-ui-admin/client/rooms/adminRooms.js +++ b/packages/rocketchat-ui-admin/client/rooms/adminRooms.js @@ -5,9 +5,10 @@ import { FlowRouter } from 'meteor/kadira:flow-router'; import { Session } from 'meteor/session'; import { Template } from 'meteor/templating'; import { TAPi18n } from 'meteor/tap:i18n'; -import { SideNav } from 'meteor/rocketchat:ui'; -import { t } from 'meteor/rocketchat:utils'; -import { RocketChat, RocketChatTabBar } from 'meteor/rocketchat:lib'; +import { SideNav, RocketChatTabBar, TabBar } from 'meteor/rocketchat:ui-utils'; +import { t, roomTypes } from 'meteor/rocketchat:utils'; +import { hasAllPermission } from 'meteor/rocketchat:authorization'; +import { ChannelSettings } from 'meteor/rocketchat:channel-settings'; import _ from 'underscore'; import s from 'underscore.string'; @@ -42,10 +43,10 @@ Template.adminRooms.helpers({ return rooms && rooms.count(); }, name() { - return RocketChat.roomTypes.roomTypes[this.t].getDisplayName(this); + return roomTypes.roomTypes[this.t].getDisplayName(this); }, type() { - return TAPi18n.__(RocketChat.roomTypes.roomTypes[this.t].label); + return TAPi18n.__(roomTypes.roomTypes[this.t].label); }, 'default'() { if (this.default) { @@ -90,7 +91,7 @@ Template.adminRooms.onCreated(function() { this.ready = new ReactiveVar(true); this.tabBar = new RocketChatTabBar(); this.tabBar.showGroup(FlowRouter.current().route.name); - RocketChat.TabBar.addButton({ + TabBar.addButton({ groups: ['admin-rooms'], id: 'admin-room', i18nTitle: 'Room_Info', @@ -98,7 +99,7 @@ Template.adminRooms.onCreated(function() { template: 'adminRoomInfo', order: 1, }); - RocketChat.ChannelSettings.addOption({ + ChannelSettings.addOption({ group: ['admin-room'], id: 'make-default', template: 'channelSettingsDefault', @@ -106,7 +107,7 @@ Template.adminRooms.onCreated(function() { return Session.get('adminRoomsSelected'); }, validation() { - return RocketChat.authz.hasAllPermission('view-room-administration'); + return hasAllPermission('view-room-administration'); }, }); this.autorun(function() { diff --git a/packages/rocketchat-ui-admin/client/rooms/channelSettingsDefault.js b/packages/rocketchat-ui-admin/client/rooms/channelSettingsDefault.js index 6d2546912186f..2c984795f9c44 100644 --- a/packages/rocketchat-ui-admin/client/rooms/channelSettingsDefault.js +++ b/packages/rocketchat-ui-admin/client/rooms/channelSettingsDefault.js @@ -2,8 +2,7 @@ import { Meteor } from 'meteor/meteor'; import { ReactiveVar } from 'meteor/reactive-var'; import { Template } from 'meteor/templating'; import { TAPi18n } from 'meteor/tap:i18n'; -import { t } from 'meteor/rocketchat:utils'; -import { handleError } from 'meteor/rocketchat:lib'; +import { t, handleError } from 'meteor/rocketchat:utils'; import { AdminChatRoom } from './adminRooms'; import toastr from 'toastr'; diff --git a/packages/rocketchat-ui-admin/client/users/adminInviteUser.js b/packages/rocketchat-ui-admin/client/users/adminInviteUser.js index d0462f0f1c4be..e504c72f319a8 100644 --- a/packages/rocketchat-ui-admin/client/users/adminInviteUser.js +++ b/packages/rocketchat-ui-admin/client/users/adminInviteUser.js @@ -1,14 +1,14 @@ import { Meteor } from 'meteor/meteor'; import { ReactiveVar } from 'meteor/reactive-var'; import { Template } from 'meteor/templating'; -import { RocketChat, handleError } from 'meteor/rocketchat:lib'; -import { t } from 'meteor/rocketchat:utils'; +import { hasAtLeastOnePermission } from 'meteor/rocketchat:authorization'; +import { t, handleError } from 'meteor/rocketchat:utils'; import _ from 'underscore'; import toastr from 'toastr'; Template.adminInviteUser.helpers({ isAllowed() { - return RocketChat.authz.hasAtLeastOnePermission('bulk-register-user'); + return hasAtLeastOnePermission('bulk-register-user'); }, inviteEmails() { return Template.instance().inviteEmails.get(); diff --git a/packages/rocketchat-ui-admin/client/users/adminUsers.js b/packages/rocketchat-ui-admin/client/users/adminUsers.js index a47800d1f2a42..51d56b09abbbb 100644 --- a/packages/rocketchat-ui-admin/client/users/adminUsers.js +++ b/packages/rocketchat-ui-admin/client/users/adminUsers.js @@ -3,8 +3,7 @@ import { ReactiveVar } from 'meteor/reactive-var'; import { Tracker } from 'meteor/tracker'; import { FlowRouter } from 'meteor/kadira:flow-router'; import { Template } from 'meteor/templating'; -import { RocketChat } from 'meteor/rocketchat:lib'; -import { SideNav } from 'meteor/rocketchat:ui'; +import { SideNav, TabBar } from 'meteor/rocketchat:ui-utils'; import _ from 'underscore'; import s from 'underscore.string'; @@ -74,7 +73,7 @@ Template.adminUsers.onCreated(function() { this.tabBar = new RocketChatTabBar(); this.tabBar.showGroup(FlowRouter.current().route.name); this.tabBarData = new ReactiveVar; - RocketChat.TabBar.addButton({ + TabBar.addButton({ groups: ['admin-users'], id: 'invite-user', i18nTitle: 'Invite_Users', @@ -82,7 +81,7 @@ Template.adminUsers.onCreated(function() { template: 'adminInviteUser', order: 1, }); - RocketChat.TabBar.addButton({ + TabBar.addButton({ groups: ['admin-users'], id: 'add-user', i18nTitle: 'Add_User', @@ -90,7 +89,7 @@ Template.adminUsers.onCreated(function() { template: 'adminUserEdit', order: 2, }); - RocketChat.TabBar.addButton({ + TabBar.addButton({ groups: ['admin-users'], id: 'admin-user-info', i18nTitle: 'User_Info', diff --git a/packages/rocketchat-ui-admin/package.js b/packages/rocketchat-ui-admin/package.js index 425121cefb672..cd31913083636 100644 --- a/packages/rocketchat-ui-admin/package.js +++ b/packages/rocketchat-ui-admin/package.js @@ -16,7 +16,13 @@ Package.onUse(function(api) { 'ecmascript', 'templating', 'rocketchat:utils', - 'rocketchat:lib', + 'rocketchat:settings', + 'rocketchat:models', + 'rocketchat:callbacks', + 'rocketchat:ui-cached-collection', + 'rocketchat:authorization', + 'rocketchat:channel-settings', + 'rocketchat:ui-utils', ]); api.mainModule('client/index.js', 'client'); api.mainModule('server/index.js', 'server'); diff --git a/packages/rocketchat-ui-admin/server/publications/adminRooms.js b/packages/rocketchat-ui-admin/server/publications/adminRooms.js index 63ebdc9182236..7b15874b44cd1 100644 --- a/packages/rocketchat-ui-admin/server/publications/adminRooms.js +++ b/packages/rocketchat-ui-admin/server/publications/adminRooms.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 _ from 'underscore'; import s from 'underscore.string'; @@ -7,7 +8,7 @@ Meteor.publish('adminRooms', function(filter, types, limit) { if (!this.userId) { return this.ready(); } - if (RocketChat.authz.hasPermission(this.userId, 'view-room-administration') !== true) { + if (hasPermission(this.userId, 'view-room-administration') !== true) { return this.ready(); } if (!_.isArray(types)) { @@ -40,12 +41,12 @@ Meteor.publish('adminRooms', function(filter, types, limit) { filter = s.trim(filter); if (filter && types.length) { // CACHE: can we stop using publications here? - return RocketChat.models.Rooms.findByNameContainingAndTypes(filter, types, options); + return Rooms.findByNameContainingAndTypes(filter, types, options); } else if (types.length) { // CACHE: can we stop using publications here? - return RocketChat.models.Rooms.findByTypes(types, options); + return Rooms.findByTypes(types, options); } else { // CACHE: can we stop using publications here? - return RocketChat.models.Rooms.findByNameContaining(filter, options); + return Rooms.findByNameContaining(filter, options); } }); diff --git a/packages/rocketchat-ui/package.js b/packages/rocketchat-ui/package.js index 7f3ad27a60e2b..7af0cd23ce2f3 100644 --- a/packages/rocketchat-ui/package.js +++ b/packages/rocketchat-ui/package.js @@ -36,6 +36,8 @@ Package.onUse(function(api) { 'rocketchat:file-upload', 'konecty:user-presence', 'rocketchat:webrtc', + 'rocketchat:markdown', + 'rocketchat:emoji', ]); api.mainModule('client/index.js', 'client'); api.mainModule('server/index.js', 'server'); diff --git a/packages/rocketchat-webdav/client/collections/WebdavAccounts.js b/packages/rocketchat-webdav/client/collections/WebdavAccounts.js index 831bfb51a00e5..4e35e772f4cce 100644 --- a/packages/rocketchat-webdav/client/collections/WebdavAccounts.js +++ b/packages/rocketchat-webdav/client/collections/WebdavAccounts.js @@ -1,4 +1,4 @@ import { RocketChat } from 'meteor/rocketchat:lib'; -import { Mongo } from 'meteor/mongo'; +import { WebdavAccounts } from 'meteor/rocketchat:models'; -RocketChat.models.WebdavAccounts = new Mongo.Collection('rocketchat_webdav_accounts'); +RocketChat.models.WebdavAccounts = WebdavAccounts;