Skip to content

Commit

Permalink
Remove dependency of RC namespace in rc-livechat/imports, lib, server…
Browse files Browse the repository at this point in the history
…/api, server/hooks and server/lib (#13379)

* 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-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
  • Loading branch information
MarcosSpessatto authored and rodrigok committed Feb 15, 2019
1 parent 62246ce commit 6b0b468
Show file tree
Hide file tree
Showing 34 changed files with 392 additions and 353 deletions.
12 changes: 6 additions & 6 deletions packages/rocketchat-livechat/imports/server/rest/departments.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import { API } from 'meteor/rocketchat:api';
import { hasPermission } from 'meteor/rocketchat:authorization';
import { LivechatDepartment, LivechatDepartmentAgents } from '../../../server/models';
import { Livechat } from '../../../server/lib/Livechat';

API.v1.addRoute('livechat/department', { authRequired: true }, {
get() {
if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) {
if (!hasPermission(this.userId, 'view-livechat-manager')) {
return API.v1.unauthorized();
}

Expand All @@ -15,7 +15,7 @@ API.v1.addRoute('livechat/department', { authRequired: true }, {
});
},
post() {
if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) {
if (!hasPermission(this.userId, 'view-livechat-manager')) {
return API.v1.unauthorized();
}

Expand Down Expand Up @@ -43,7 +43,7 @@ API.v1.addRoute('livechat/department', { authRequired: true }, {

API.v1.addRoute('livechat/department/:_id', { authRequired: true }, {
get() {
if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) {
if (!hasPermission(this.userId, 'view-livechat-manager')) {
return API.v1.unauthorized();
}

Expand All @@ -61,7 +61,7 @@ API.v1.addRoute('livechat/department/:_id', { authRequired: true }, {
}
},
put() {
if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) {
if (!hasPermission(this.userId, 'view-livechat-manager')) {
return API.v1.unauthorized();
}

Expand All @@ -88,7 +88,7 @@ API.v1.addRoute('livechat/department/:_id', { authRequired: true }, {
}
},
delete() {
if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) {
if (!hasPermission(this.userId, 'view-livechat-manager')) {
return API.v1.unauthorized();
}

Expand Down
12 changes: 6 additions & 6 deletions packages/rocketchat-livechat/imports/server/rest/facebook.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import crypto from 'crypto';
import { Random } from 'meteor/random';
import { RocketChat } from 'meteor/rocketchat:lib';
import { API } from 'meteor/rocketchat:api';

import { Rooms, Users } from 'meteor/rocketchat:models';
import { settings } from 'meteor/rocketchat:settings';
import LivechatVisitors from '../../../server/models/LivechatVisitors';
import { Livechat } from '../../../server/lib/Livechat';

Expand Down Expand Up @@ -33,15 +33,15 @@ API.v1.addRoute('livechat/facebook', {
};
}

if (!RocketChat.settings.get('Livechat_Facebook_Enabled')) {
if (!settings.get('Livechat_Facebook_Enabled')) {
return {
success: false,
error: 'Integration disabled',
};
}

// validate if request come from omni
const signature = crypto.createHmac('sha1', RocketChat.settings.get('Livechat_Facebook_API_Secret')).update(JSON.stringify(this.request.body)).digest('hex');
const signature = crypto.createHmac('sha1', settings.get('Livechat_Facebook_API_Secret')).update(JSON.stringify(this.request.body)).digest('hex');
if (this.request.headers['x-hub-signature'] !== `sha1=${ signature }`) {
return {
success: false,
Expand All @@ -61,7 +61,7 @@ API.v1.addRoute('livechat/facebook', {
};
let visitor = LivechatVisitors.getVisitorByToken(this.bodyParams.token);
if (visitor) {
const rooms = RocketChat.models.Rooms.findOpenByVisitorToken(visitor.token).fetch();
const rooms = Rooms.findOpenByVisitorToken(visitor.token).fetch();
if (rooms && rooms.length > 0) {
sendMessage.message.rid = rooms[0]._id;
} else {
Expand All @@ -77,7 +77,7 @@ API.v1.addRoute('livechat/facebook', {
name: `${ this.bodyParams.first_name } ${ this.bodyParams.last_name }`,
});

visitor = RocketChat.models.Users.findOneById(userId);
visitor = Users.findOneById(userId);
}

sendMessage.message.msg = this.bodyParams.text;
Expand Down
4 changes: 2 additions & 2 deletions packages/rocketchat-livechat/imports/server/rest/sms.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Rooms } from 'meteor/rocketchat:models';
import { API } from 'meteor/rocketchat:api';
import { SMS } from 'meteor/rocketchat:sms';
import LivechatVisitors from '../../../server/models/LivechatVisitors';
Expand All @@ -26,7 +26,7 @@ API.v1.addRoute('livechat/sms-incoming/:service', {
};

if (visitor) {
const rooms = RocketChat.models.Rooms.findOpenByVisitorToken(visitor.token).fetch();
const rooms = Rooms.findOpenByVisitorToken(visitor.token).fetch();

if (rooms && rooms.length > 0) {
sendMessage.message.rid = rooms[0]._id;
Expand Down
12 changes: 7 additions & 5 deletions packages/rocketchat-livechat/imports/server/rest/upload.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { settings } from 'meteor/rocketchat:settings';
import { Settings, Rooms } from 'meteor/rocketchat:models';
import { fileUploadIsValidContentType } from 'meteor/rocketchat:utils';
import { FileUpload } from 'meteor/rocketchat:file-upload';
import { API } from 'meteor/rocketchat:api';
import Busboy from 'busboy';
import filesize from 'filesize';
import LivechatVisitors from '../../../server/models/LivechatVisitors';
let maxFileSize;

RocketChat.settings.get('FileUpload_MaxFileSize', function(key, value) {
settings.get('FileUpload_MaxFileSize', function(key, value) {
try {
maxFileSize = parseInt(value);
} catch (e) {
maxFileSize = RocketChat.models.Settings.findOneById('FileUpload_MaxFileSize').packageValue;
maxFileSize = Settings.findOneById('FileUpload_MaxFileSize').packageValue;
}
});

Expand All @@ -28,7 +30,7 @@ API.v1.addRoute('livechat/upload/:rid', {
return API.v1.unauthorized();
}

const room = RocketChat.models.Rooms.findOneOpenByRoomIdAndVisitorToken(this.urlParams.rid, visitorToken);
const room = Rooms.findOneOpenByRoomIdAndVisitorToken(this.urlParams.rid, visitorToken);
if (!room) {
return API.v1.unauthorized();
}
Expand Down Expand Up @@ -68,7 +70,7 @@ API.v1.addRoute('livechat/upload/:rid', {

const file = files[0];

if (!RocketChat.fileUploadIsValidContentType(file.mimetype)) {
if (!fileUploadIsValidContentType(file.mimetype)) {
return API.v1.failure({
reason: 'error-type-not-allowed',
});
Expand Down
17 changes: 9 additions & 8 deletions packages/rocketchat-livechat/imports/server/rest/users.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import { hasPermission, getUsersInRole } from 'meteor/rocketchat:authorization';
import { API } from 'meteor/rocketchat:api';
import { Users } from 'meteor/rocketchat:models';
import { Livechat } from '../../../server/lib/Livechat';
import _ from 'underscore';

API.v1.addRoute('livechat/users/:type', { authRequired: true }, {
get() {
if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) {
if (!hasPermission(this.userId, 'view-livechat-manager')) {
return API.v1.unauthorized();
}

Expand All @@ -24,7 +25,7 @@ API.v1.addRoute('livechat/users/:type', { authRequired: true }, {
throw 'Invalid type';
}

const users = RocketChat.authz.getUsersInRole(role);
const users = getUsersInRole(role);

return API.v1.success({
users: users.fetch().map((user) => _.pick(user, '_id', 'username', 'name', 'status', 'statusLivechat')),
Expand All @@ -34,7 +35,7 @@ API.v1.addRoute('livechat/users/:type', { authRequired: true }, {
}
},
post() {
if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) {
if (!hasPermission(this.userId, 'view-livechat-manager')) {
return API.v1.unauthorized();
}
try {
Expand Down Expand Up @@ -69,7 +70,7 @@ API.v1.addRoute('livechat/users/:type', { authRequired: true }, {

API.v1.addRoute('livechat/users/:type/:_id', { authRequired: true }, {
get() {
if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) {
if (!hasPermission(this.userId, 'view-livechat-manager')) {
return API.v1.unauthorized();
}

Expand All @@ -79,7 +80,7 @@ API.v1.addRoute('livechat/users/:type/:_id', { authRequired: true }, {
_id: String,
});

const user = RocketChat.models.Users.findOneById(this.urlParams._id);
const user = Users.findOneById(this.urlParams._id);

if (!user) {
return API.v1.failure('User not found');
Expand Down Expand Up @@ -109,7 +110,7 @@ API.v1.addRoute('livechat/users/:type/:_id', { authRequired: true }, {
}
},
delete() {
if (!RocketChat.authz.hasPermission(this.userId, 'view-livechat-manager')) {
if (!hasPermission(this.userId, 'view-livechat-manager')) {
return API.v1.unauthorized();
}

Expand All @@ -119,7 +120,7 @@ API.v1.addRoute('livechat/users/:type/:_id', { authRequired: true }, {
_id: String,
});

const user = RocketChat.models.Users.findOneById(this.urlParams._id);
const user = Users.findOneById(this.urlParams._id);

if (!user) {
return API.v1.failure();
Expand Down
9 changes: 6 additions & 3 deletions packages/rocketchat-livechat/lib/LivechatRoomType.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Session } from 'meteor/session';
import { ChatRoom } from 'meteor/rocketchat:ui';
import { RocketChat, RoomSettingsEnum, RoomTypeConfig, RoomTypeRouteConfig, UiTextContext, openRoom } from 'meteor/rocketchat:lib';
import { ChatRoom } from 'meteor/rocketchat:models';
import { settings } from 'meteor/rocketchat:settings';
import { hasPermission } from 'meteor/rocketchat:authorization';
import { openRoom } from 'meteor/rocketchat:ui-utils';
import { RoomSettingsEnum, UiTextContext, RoomTypeRouteConfig, RoomTypeConfig } from 'meteor/rocketchat:utils';
import { LivechatInquiry } from './LivechatInquiry';

class LivechatRoomRoute extends RoomTypeRouteConfig {
Expand Down Expand Up @@ -46,7 +49,7 @@ export default class LivechatRoomType extends RoomTypeConfig {
}

condition() {
return RocketChat.settings.get('Livechat_enabled') && RocketChat.authz.hasPermission('view-l-room');
return settings.get('Livechat_enabled') && hasPermission('view-l-room');
}

canSendMessage(roomId) {
Expand Down
24 changes: 14 additions & 10 deletions packages/rocketchat-livechat/lib/messageTypes.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { Meteor } from 'meteor/meteor';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { MessageTypes } from 'meteor/rocketchat:ui-utils';
import { actionLinks } from 'meteor/rocketchat:action-links';
import { Notifications } from 'meteor/rocketchat:notifications';
import { Messages, Rooms } from 'meteor/rocketchat:models';
import { settings } from 'meteor/rocketchat:settings';
import { Livechat } from 'meteor/rocketchat:livechat';

RocketChat.MessageTypes.registerType({
MessageTypes.registerType({
id: 'livechat_navigation_history',
system: true,
message: 'New_visitor_navigation',
Expand All @@ -17,34 +21,34 @@ RocketChat.MessageTypes.registerType({
},
});

RocketChat.MessageTypes.registerType({
MessageTypes.registerType({
id: 'livechat_video_call',
system: true,
message: 'New_videocall_request',
});

RocketChat.actionLinks.register('createLivechatCall', function(message, params, instance) {
actionLinks.register('createLivechatCall', function(message, params, instance) {
if (Meteor.isClient) {
instance.tabBar.open('video');
}
});

RocketChat.actionLinks.register('denyLivechatCall', function(message/* , params*/) {
actionLinks.register('denyLivechatCall', function(message/* , params*/) {
if (Meteor.isServer) {
const user = Meteor.user();

RocketChat.models.Messages.createWithTypeRoomIdMessageAndUser('command', message.rid, 'endCall', user);
RocketChat.Notifications.notifyRoom(message.rid, 'deleteMessage', { _id: message._id });
Messages.createWithTypeRoomIdMessageAndUser('command', message.rid, 'endCall', user);
Notifications.notifyRoom(message.rid, 'deleteMessage', { _id: message._id });

const language = user.language || RocketChat.settings.get('Language') || 'en';
const language = user.language || settings.get('Language') || 'en';

Livechat.closeRoom({
user,
room: RocketChat.models.Rooms.findOneById(message.rid),
room: Rooms.findOneById(message.rid),
comment: TAPi18n.__('Videocall_declined', { lng: language }),
});
Meteor.defer(() => {
RocketChat.models.Messages.setHiddenById(message._id);
Messages.setHiddenById(message._id);
});
}
});
2 changes: 2 additions & 0 deletions packages/rocketchat-livechat/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ Package.onUse(function(api) {
'webapp',
'autoupdate',
'rocketchat:utils',
'rocketchat:action-links',
'rocketchat:ui-utils',
'rocketchat:settings',
'rocketchat:callbacks',
'rocketchat:models',
'rocketchat:lib',
'rocketchat:authorization',
Expand Down
4 changes: 2 additions & 2 deletions packages/rocketchat-livechat/server/agentStatus.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { RocketChat } from 'meteor/rocketchat:lib';
import { hasRole } from 'meteor/rocketchat:authorization';
import { UserPresenceMonitor } from 'meteor/konecty:user-presence';
import { Livechat } from './lib/Livechat';

UserPresenceMonitor.onSetUserStatus((user, status) => {
if (RocketChat.authz.hasRole(user._id, 'livechat-manager') || RocketChat.authz.hasRole(user._id, 'livechat-agent')) {
if (hasRole(user._id, 'livechat-manager') || hasRole(user._id, 'livechat-agent')) {
Livechat.notifyAgentStatusChanged(user._id, status);
}
});
12 changes: 6 additions & 6 deletions packages/rocketchat-livechat/server/api/lib/livechat.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Users, Rooms } from 'meteor/rocketchat:models';
import { LivechatDepartment, LivechatTrigger } from '../../models';
import _ from 'underscore';
import LivechatVisitors from '../../models/LivechatVisitors';
import { Livechat } from '../../lib/Livechat';

export function online() {
return RocketChat.models.Users.findOnlineAgents().count() > 0;
return Users.findOnlineAgents().count() > 0;
}

export function findTriggers() {
Expand Down Expand Up @@ -38,10 +38,10 @@ export function findRoom(token, rid) {
};

if (!rid) {
return RocketChat.models.Rooms.findLivechatByVisitorToken(token, fields);
return Rooms.findLivechatByVisitorToken(token, fields);
}

return RocketChat.models.Rooms.findLivechatByIdAndVisitorToken(rid, token, fields);
return Rooms.findLivechatByIdAndVisitorToken(rid, token, fields);
}

export function findOpenRoom(token, departmentId) {
Expand All @@ -54,7 +54,7 @@ export function findOpenRoom(token, departmentId) {
};

let room;
const rooms = departmentId ? RocketChat.models.Rooms.findOpenByVisitorTokenAndDepartmentId(token, departmentId, options).fetch() : RocketChat.models.Rooms.findOpenByVisitorToken(token, options).fetch();
const rooms = departmentId ? Rooms.findOpenByVisitorTokenAndDepartmentId(token, departmentId, options).fetch() : Rooms.findOpenByVisitorToken(token, options).fetch();
if (rooms && rooms.length > 0) {
room = rooms[0];
}
Expand All @@ -77,7 +77,7 @@ export function getRoom(guest, rid, roomInfo) {
}

export function findAgent(agentId) {
return RocketChat.models.Users.getAgentInfo(agentId);
return Users.getAgentInfo(agentId);
}

export function settings() {
Expand Down
4 changes: 2 additions & 2 deletions packages/rocketchat-livechat/server/api/v1/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RocketChat } from 'meteor/rocketchat:lib';
import { Users } from 'meteor/rocketchat:models';
import { API } from 'meteor/rocketchat:api';
import { findGuest, settings, online, findOpenRoom } from '../lib/livechat';
import { Match, check } from 'meteor/check';
Expand Down Expand Up @@ -26,7 +26,7 @@ API.v1.addRoute('livechat/config', {
if (token) {
guest = findGuest(token);
room = findOpenRoom(token);
agent = room && room.servedBy && RocketChat.models.Users.getAgentInfo(room.servedBy._id);
agent = room && room.servedBy && Users.getAgentInfo(room.servedBy._id);
}

Object.assign(config, { online: status, guest, room, agent });
Expand Down
Loading

0 comments on commit 6b0b468

Please sign in to comment.