Remove dependency of RC namespace in root client folder, imports/message-read-receipt and imports/personal-access-tokens (#13389)

* Remove some dependencies inside rocketchat-lib/client  (#13210)

* Move function to rc-utils

* Change import from to export directly

* Removing duplicated dependency and remove old code

* Import some variables to remove dependency of RC namespace

* Remove some dependencies inside rocketchat-lib/lib (#13212)

* Move some functions from lib to rc-ui-utils

* Move some functions from lib ro rc-utils

* Remove hostname from RC namespace

* Import variables to remove dependency of RC namespace

* Remove some dependencies inside rocketchat-lib/server/functions (#13214)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Remove some dependencies inside rocketchat-lib/server/lib (#13217)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Remove some dependencies inside rocketchat-lib/server/methods (#13218)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Remove some dependencies inside rocketchat-lib/server/startup, publications... (#13222)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings (#13223)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

*  Export functions and lib function of rc-lib but keep it inside RC namespace (#13225)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Fix missed exports and re-add some functions to RC namespace

*  Import variables from functions and lib to remove RC namespace dependency (#13226)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

*  Remove dependency of RC namespace in rc-sandstorm (#13227)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

*  Remove dependency of RC namespace in chatpal-search (#13231)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

*  Remove dependency of RC namespace in meteor saml (#13233)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

*  Remove dependency of RC namespace in rc-theme (#13234)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

*  Remove dependency of RC namespace in rc-2fa (#13235)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

*  Remove dependency of RC namespace in rc-action-links (#13236)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

*  Remove dependency of RC namespace in rc-analytics and rc-assets (#13237)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Rename Assets variable to avoid conflicts

* Fix rename Assets

*  Remove dependency of RC namespace in rc-markdown, rc-autolinker and rc-autotranslate (#13240)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Fix wrong imports

*  Remove dependency of RC namespace in rc-blockstack, bot-helpers and cas (#13246)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-settings (#13251)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* readd saveRoomName to RC namespace

*  Remove dependency of RC namespace in rc-channel-mail-messages and cloud (#13254)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-mail-messages

* Remove dependency of RC namespace in rc-cloud

*  Remove dependency of RC namespace in rc-colors, cors, crowd and dolphin (#13255)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-mail-messages

* Remove dependency of RC namespace in rc-cloud

* Remove dependency of RC namespace in rc-colors

* Remove dependency of RC namespace in rc-cors

* Remove dependency of RC namespace in rc-crowd

* Remove dependency of RC namespace in rc-dolphin

*  Remove dependency of RC namespace in rc-emoji-custom and drupal (#13256)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-mail-messages

* Remove dependency of RC namespace in rc-cloud

* Remove dependency of RC namespace in rc-colors

* Remove dependency of RC namespace in rc-cors

* Remove dependency of RC namespace in rc-crowd

* Remove dependency of RC namespace in rc-dolphin

* Remove dependency of RC namespace in rc-drupal

* Move Emoji custom server and client models to rc-models

* Remove dependency of RC namespace in rc-emoji-custom

* Remove dependency of RC namespace in rc-emojione, error-handler, gh-enterprise and gitlab (#13257)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-mail-messages

* Remove dependency of RC namespace in rc-cloud

* Remove dependency of RC namespace in rc-colors

* Remove dependency of RC namespace in rc-cors

* Remove dependency of RC namespace in rc-crowd

* Remove dependency of RC namespace in rc-dolphin

* Remove dependency of RC namespace in rc-drupal

* Move Emoji custom server and client models to rc-models

* Remove dependency of RC namespace in rc-emoji-custom

* Remove dependency of RC namespace in rc-emojione

* Remove dependency of RC namespace in rc-error-handler

* Remove dependency of RC namespace in rc-gh-enterprise

* Remove dependency of RC namespace in rc-gitlab

* Remove dependency of RC namespace in rc-google-natural-language, grant, google-vision and highlight-words (#13258)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-mail-messages

* Remove dependency of RC namespace in rc-cloud

* Remove dependency of RC namespace in rc-colors

* Remove dependency of RC namespace in rc-cors

* Remove dependency of RC namespace in rc-crowd

* Remove dependency of RC namespace in rc-dolphin

* Remove dependency of RC namespace in rc-drupal

* Move Emoji custom server and client models to rc-models

* Remove dependency of RC namespace in rc-emoji-custom

* Remove dependency of RC namespace in rc-emojione

* Remove dependency of RC namespace in rc-error-handler

* Remove dependency of RC namespace in rc-gh-enterprise

* Remove dependency of RC namespace in rc-gitlab

* Remove dependency of RC namespace in rc-google-natural-language

* Remove dependency of RC namespace in rc-grant

* Remove dependency of RC namespace in rc-highlight-words

* Remove dependency of RC namespace in rc-google-vision

* Fix lint

*  Remove dependency of RC namespace in rc-iframe-login and all imports, except hipchat-enterprise (#13259)

* Move integrations models to rc-models

* Move composeMessage function to rc-utils

* Move PushNotifications class to push-notifications package

* Import variables to remove dependency of RC namespace

* Import variables to remove RC namespace dependency inside rc-lib/server/lib

* Import variables to remove RC namespace inside rc-lib/server/methods

* Import variables to remove dependency with RC namespace

* Remove duplicated server settings located in rc-lib

* Export function and lib function of rc-lib but keep it inside RC namespace

* Import variables from functions and lib to remove RC namespace dependency

* Remove dependency of RC namespace in rc-sandstorm

* Remove dependency of RC namespace in chatpal-search

* Move CreadentialTokens model to rc-models

* Move getUsernameSuggestion function and method from server/ to rc-lib

* Remove dependency of RC namespace in meteor saml

* Remove dependency of RC namespace in rc-theme

* Move 2FA Users model to rc-models

* Remove dependency of RC namespace in rc-2fa

* Remove dependency of RC namespace in rc-action-links

* Add action links in the RC namespace

* Remove dependency of RC namespace in rc-analytics

* Remove dependency of RC namespace in rc-assets

* Add Assets in RC namespace

* Remove dependency of RC namespace in rc-autolinker

* Move autotranslate models to rc-models

* Partial remove dependency of Rc namespace in rc-autotranslate

* Remove dependency of RC namespace in rc-markdown

* Finish of remotion of RC namespace in rc-autotranslate

* Import Autotranslate where it has been used

* Fix lint

* Rename Assets variable to avoid conflicts

* Fix rename Assets

* Remove dependency of RC namespace in rc-blockstack

* Remove RC dependency in bot-helpers

* Remove RC dependency in rc-cas

* Move some functions from tokenpass to channel settings and models

* Move some function from livestream to channel settings

* Remove dependency of RC namespace in rc-channel-settings

* Fix wrong imports

* Remove dependency of RC namespace in rc-channel-mail-messages

* Remove dependency of RC namespace in rc-cloud

* Remove dependency of RC namespace in rc-colors

* Remove dependency of RC namespace in rc-cors

* Remove dependency of RC namespace in rc-crowd

* Remove dependency of RC namespace in rc-dolphin

* Remove dependency of RC namespace in rc-drupal

* Move Emoji custom server and client models to rc-models

* Remove dependency of RC namespace in rc-emoji-custom

* Remove dependency of RC namespace in rc-emojione

* Remove dependency of RC namespace in rc-error-handler

* Remove dependency of RC namespace in rc-gh-enterprise

* Remove dependency of RC namespace in rc-gitlab

* Remove dependency of RC namespace in rc-google-natural-language

* Remove dependency of RC namespace in rc-grant

* Remove dependency of RC namespace in rc-highlight-words

* Remove dependency of RC namespace in rc-google-vision

* Fix lint

* Remove dependency of RC namespace in rc-iframe-login

* Remove dependency of RC namespace in all importes, except hipchat-enterprise

* Move RestAPI client to rc-api package

* Remove dependency of RC namespace in rc-api/helpers and api.js

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

* import API where it was being used by the RC namespace

* Move processWebhookMessage function to rc-lib package

* Remove API from RC namespace and import missing function that was being used with namespace

* Remove dependency of RC namespace in rc-graphql

* Fix import from wrong package

* Remove dependency of RC namespace in rc-importer

* Remove dependency of RC namespace in rc-issue-links

* Remove dependency of RC namespace in rc-katex

* Move templateVarHandler fn to rc-utils

* Remove dependency of RC namespace in rc-ldap

* Remove dependency of RC namespace in rc-livestream

* Remove dependency of RC namespace in rc-mail-messages

* Remove dependency of RC namespace in rc-mapview

* Remove dependency of RC namespace in rc-mentions

* Remove dependency of RC namespace in rc-mentions-flextab

* Remove depedency of RC namespace in rc-message-attachements

* Remove dependdency of RC namespace in rc-message-mark-as-unread

* Remove dependency of RC namespace in rc-message-pin

* Fix templateVarHandler that was in wrong folder

* Remove namespace in the new livechat endpoint

* Remove dependency of RC namespace in rc-message-snippet

* Remove dependency of RC namespace in rc-message-star

* Remove dependency of RC namespace in rc-oauth2

* Remove dependency of RC namespace in rc-oembed

* Remove dependency of RC namespace in rc-otr

* Remove dependency of RC namespace in rc-reactions

* Remove dependency of RC namespace in rc-retention-policy

* Remove dependency of RC namespace in rc-earch

* Remove dependency of RC namespace in rc-setup-wizard

* Remove dependency of RC namespace in rc-slackbridge

* Remove dependency of Rc namespace in slashcommands-asciiarts

* Remove depedency of RC namespace in rc-slash-archiveroom

* Remove dependency of RC namespace in rc-slash-create

* Remove dependency of RC namespace in rc-slash-help

* Remove dependency of RC namespace in rc-slash-hide

* Remove dependency of RC namespace in rc-slash-invite

* Remove dependency of RC namespace in rc-slash-inviteall

* Remove dependency of RC namespace in rc-slash-join

* Remove dependency of RC namespace in rc-slash-kick

* Remove dependency of RC namespace in rc-slash-leave

* Remove dependency of RC namespace in rc-slash-me

* Remove dependency of RC namespace in rc-slash-msg

* Remove dependency of RC namespace in rc-slash-mute

* Remove dependency of RC namespace in rc-slash-open

* Remove dependency of RC namespace in rc-slash-topic

* Remove dependency of RC namespace in rc-slash-unarchiveroom

* Remove dependency of RC namespace in rc-smarsh-connector

* Remove dependency of RC namespace in rc-sms

* Remove dependency of RC namespace in rc-spotify

* Remove dependency of RC namespace in rc-statistics

* Move tokenpass models methods to rc-models

* Remove dependency of RC namespace in rc-tokenpass

* import tokenpass inside rc-lib

* Remove dependency of RC namespace in rc-ui

* Move webdavAccounts models to rc-model

* Remove dependency of RC namespace in rc-ui-account

* Remove dependency of RC namespace in rc-ui-admin

* Remove dependency of RC namespace in rc-ui-clean-history

* Remove dependency of RC namespace in rc-ui-flextab

* Remove dependency of RC namespace in rc-ui-login

* Remove dependency of RC namespace in rc-ui-master

* Remove dependency of RC namespace in rc-ui-message

* REmove dependency of RC namespace in rc-user-data-download

* Remove dependency of RC namespace in rc-version-check

* Remove dependency of RC namespace in rc-videobridge

* Remove dependency of RC namespace in rc-webdav

* Remove dependency of RC namespace in rc-wordpress

* Remove some RC namespace use in chatpal-search

* Remove dependency of RC namespace in rc-irc

* Remove dependency of RC namespace in livechat/client

* Move methods in common livechat models to rc-models

* Remove dependency of RC namespace in rc-livechat/server/models

* Remove LIvechat global variable from RC namespace

* Remove dependency of RC namespace in rc-livechat/imports, lib, server/api, server/hooks and server/lib

* Remove dependency of RC namespace in rc-livechat/server/methods

* Fix duplicated import

* Remove unused import

* Remove dependency of RC namespace in rc-livechat/server/publications

* MOve rc-livechat server models to rc-models

* Change imports of livechat server models to rc-models package

*  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

* Remove dependency of RC namespace in rc-integrations

* Import missed functions in rc-irc

* Remove dependency of RC namespace in rc-hipchat-enterprise-importer

* 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 root client folder

* Remove dependency of RC namespace in imports/message-read-receipt

* Remove dependency of RC namespace in imports/personal-access-tokens

* 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
pull/13400/head^2
Marcos Spessatto Defendi 6 years ago committed by Rodrigo Nascimento
parent 7cdb04426e
commit 3f3f02c96b
  1. 10
      client/methods/deleteMessage.js
  2. 11
      client/methods/updateMessage.js
  3. 10
      client/notifications/UsersNameChanged.js
  4. 20
      client/notifications/notification.js
  5. 5
      client/notifications/updateAvatar.js
  6. 5
      client/notifications/updateUserState.js
  7. 3
      client/routes/roomRoute.js
  8. 3
      client/routes/router.js
  9. 3
      client/startup/emailVerification.js
  10. 6
      client/startup/i18n.js
  11. 13
      client/startup/startup.js
  12. 6
      client/startup/unread.js
  13. 3
      client/startup/userSetUtcOffset.js
  14. 3
      imports/message-read-receipt/client/main.js
  15. 3
      imports/message-read-receipt/client/message.js
  16. 3
      imports/message-read-receipt/client/readReceipts.js
  17. 7
      imports/message-read-receipt/client/room.js
  18. 4
      imports/message-read-receipt/server/api/methods/getReadReceipts.js
  19. 5
      imports/message-read-receipt/server/dbIndexes.js
  20. 6
      imports/message-read-receipt/server/hooks.js
  21. 1
      imports/message-read-receipt/server/index.js
  22. 27
      imports/message-read-receipt/server/lib/ReadReceipt.js
  23. 6
      imports/message-read-receipt/server/settings.js
  24. 3
      imports/personal-access-tokens/client/personalAccessTokens.js
  25. 8
      imports/personal-access-tokens/server/api/methods/generateToken.js
  26. 6
      imports/personal-access-tokens/server/api/methods/regenerateToken.js
  27. 8
      imports/personal-access-tokens/server/api/methods/removeToken.js
  28. 1
      imports/personal-access-tokens/server/index.js
  29. 39
      imports/personal-access-tokens/server/models/Users.js
  30. 1
      imports/personal-access-tokens/server/models/index.js
  31. 6
      imports/personal-access-tokens/server/publications/personalAccessTokens.js
  32. 2
      packages/rocketchat-models/server/index.js
  33. 1
      packages/rocketchat-models/server/models/Messages.js
  34. 6
      packages/rocketchat-models/server/models/ReadReceipts.js
  35. 39
      packages/rocketchat-models/server/models/Users.js

@ -1,6 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { ChatMessage } from 'meteor/rocketchat:models';
import { hasAtLeastOnePermission } from 'meteor/rocketchat:authorization';
import { settings } from 'meteor/rocketchat:settings';
import _ from 'underscore';
import moment from 'moment';
@ -13,9 +15,9 @@ Meteor.methods({
// We're now only passed in the `_id` property to lower the amount of data sent to the server
message = ChatMessage.findOne({ _id: message._id });
const hasPermission = RocketChat.authz.hasAtLeastOnePermission('delete-message', message.rid);
const forceDelete = RocketChat.authz.hasAtLeastOnePermission('force-delete-message', message.rid);
const deleteAllowed = RocketChat.settings.get('Message_AllowDeleting');
const hasPermission = hasAtLeastOnePermission('delete-message', message.rid);
const forceDelete = hasAtLeastOnePermission('force-delete-message', message.rid);
const deleteAllowed = settings.get('Message_AllowDeleting');
let deleteOwn = false;
if (message && message.u && message.u._id) {
@ -24,7 +26,7 @@ Meteor.methods({
if (!(forceDelete || hasPermission || (deleteAllowed && deleteOwn))) {
return false;
}
const blockDeleteInMinutes = RocketChat.settings.get('Message_AllowDeleting_BlockDeleteInMinutes');
const blockDeleteInMinutes = settings.get('Message_AllowDeleting_BlockDeleteInMinutes');
if (!forceDelete && _.isNumber(blockDeleteInMinutes) && blockDeleteInMinutes !== 0) {
const msgTs = moment(message.ts);
const currentTsDiff = moment().diff(msgTs, 'minutes');

@ -3,6 +3,9 @@ import { Tracker } from 'meteor/tracker';
import { TimeSync } from 'meteor/mizzao:timesync';
import { t } from 'meteor/rocketchat:utils';
import { ChatMessage } from 'meteor/rocketchat:models';
import { hasAtLeastOnePermission } from 'meteor/rocketchat:authorization';
import { settings } from 'meteor/rocketchat:settings';
import { callbacks } from 'meteor/rocketchat:callbacks';
import _ from 'underscore';
import moment from 'moment';
import toastr from 'toastr';
@ -15,8 +18,8 @@ Meteor.methods({
const originalMessage = ChatMessage.findOne(message._id);
const hasPermission = RocketChat.authz.hasAtLeastOnePermission('edit-message', message.rid);
const editAllowed = RocketChat.settings.get('Message_AllowEditing');
const hasPermission = hasAtLeastOnePermission('edit-message', message.rid);
const editAllowed = settings.get('Message_AllowEditing');
let editOwn = false;
if (originalMessage.msg === message.msg) {
return;
@ -32,7 +35,7 @@ Meteor.methods({
return false;
}
const blockEditInMinutes = RocketChat.settings.get('Message_AllowEditing_BlockEditInMinutes');
const blockEditInMinutes = settings.get('Message_AllowEditing_BlockEditInMinutes');
if (_.isNumber(blockEditInMinutes) && blockEditInMinutes !== 0) {
if (originalMessage.ts) {
const msgTs = moment(originalMessage.ts);
@ -59,7 +62,7 @@ Meteor.methods({
username: me.username,
};
message = RocketChat.callbacks.run('beforeSaveMessage', message);
message = callbacks.run('beforeSaveMessage', message);
const messageObject = { editedAt: message.editedAt, editedBy: message.editedBy, msg: message.msg };
if (originalMessage.attachments) {

@ -1,8 +1,10 @@
import { Meteor } from 'meteor/meteor';
import { Notifications } from 'meteor/rocketchat:notifications';
import { Messages, Subscriptions } from 'meteor/rocketchat:models';
Meteor.startup(function() {
RocketChat.Notifications.onLogged('Users:NameChanged', function({ _id, name, username }) {
RocketChat.models.Messages.update({
Notifications.onLogged('Users:NameChanged', function({ _id, name, username }) {
Messages.update({
'u._id': _id,
}, {
$set: {
@ -12,7 +14,7 @@ Meteor.startup(function() {
multi: true,
});
RocketChat.models.Messages.update({
Messages.update({
mentions: {
$elemMatch: { _id },
},
@ -24,7 +26,7 @@ Meteor.startup(function() {
multi: true,
});
RocketChat.models.Subscriptions.update({
Subscriptions.update({
name: username,
t: 'd',
}, {

@ -2,7 +2,11 @@ import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { Session } from 'meteor/session';
import { KonchatNotification, fireGlobalEvent, readMessage, CachedChatSubscription } from 'meteor/rocketchat:ui';
import { KonchatNotification } from 'meteor/rocketchat:ui';
import { CachedChatSubscription } from 'meteor/rocketchat:models';
import { fireGlobalEvent, readMessage, Layout } from 'meteor/rocketchat:ui-utils';
import { getUserPreference } from 'meteor/rocketchat:utils';
import { Notifications } from 'meteor/rocketchat:notifications';
// Show notifications and play a sound for new messages.
// We trust the server to only send notifications for interesting messages, e.g. direct messages or
@ -23,7 +27,7 @@ function notifyNewRoom(sub) {
Meteor.startup(function() {
Tracker.autorun(function() {
if (Meteor.userId()) {
RocketChat.Notifications.onUser('notification', function(notification) {
Notifications.onUser('notification', function(notification) {
let openedRoomId = undefined;
if (['channel', 'group', 'direct'].includes(FlowRouter.getRouteName())) {
@ -33,7 +37,7 @@ Meteor.startup(function() {
// This logic is duplicated in /client/startup/unread.coffee.
const hasFocus = readMessage.isEnable();
const messageIsInOpenedRoom = openedRoomId === notification.payload.rid;
const muteFocusedConversations = RocketChat.getUserPreference(Meteor.userId(), 'muteFocusedConversations');
const muteFocusedConversations = getUserPreference(Meteor.userId(), 'muteFocusedConversations');
fireGlobalEvent('notification', {
notification,
@ -41,7 +45,7 @@ Meteor.startup(function() {
hasFocus,
});
if (RocketChat.Layout.isEmbedded()) {
if (Layout.isEmbedded()) {
if (!hasFocus && messageIsInOpenedRoom) {
// Play a sound and show a notification.
KonchatNotification.newMessage(notification.payload.rid);
@ -57,16 +61,16 @@ Meteor.startup(function() {
}
});
RocketChat.Notifications.onUser('audioNotification', function(notification) {
Notifications.onUser('audioNotification', function(notification) {
const openedRoomId = Session.get('openedRoom');
// This logic is duplicated in /client/startup/unread.coffee.
const hasFocus = readMessage.isEnable();
const messageIsInOpenedRoom = openedRoomId === notification.payload.rid;
const muteFocusedConversations = RocketChat.getUserPreference(Meteor.userId(), 'muteFocusedConversations');
const muteFocusedConversations = getUserPreference(Meteor.userId(), 'muteFocusedConversations');
if (RocketChat.Layout.isEmbedded()) {
if (Layout.isEmbedded()) {
if (!hasFocus && messageIsInOpenedRoom) {
// Play a notification sound
KonchatNotification.newMessage(notification.payload.rid);
@ -83,7 +87,7 @@ Meteor.startup(function() {
}
};
RocketChat.Notifications.onUser('subscriptions-changed', (action, sub) => {
Notifications.onUser('subscriptions-changed', (action, sub) => {
notifyNewRoom(sub);
});
}

@ -1,8 +1,9 @@
import { Meteor } from 'meteor/meteor';
import { updateAvatarOfUsername } from 'meteor/rocketchat:ui';
import { updateAvatarOfUsername } from 'meteor/rocketchat:ui-utils';
import { Notifications } from 'meteor/rocketchat:notifications';
Meteor.startup(function() {
RocketChat.Notifications.onLogged('updateAvatar', function(data) {
Notifications.onLogged('updateAvatar', function(data) {
updateAvatarOfUsername(data.username);
});
});

@ -1,9 +1,10 @@
import { Meteor } from 'meteor/meteor';
import { fireGlobalEvent } from 'meteor/rocketchat:ui';
import { fireGlobalEvent } from 'meteor/rocketchat:ui-utils';
import { callbacks } from 'meteor/rocketchat:callbacks';
/* fire user state change globally, to listen on desktop electron client */
Meteor.startup(function() {
RocketChat.callbacks.add('userStatusManuallySet', (status) => {
callbacks.add('userStatusManuallySet', (status) => {
fireGlobalEvent('user-status-manually-set', status);
});
});

@ -1,9 +1,10 @@
import { FlowRouter } from 'meteor/kadira:flow-router';
import { ChatSubscription } from 'meteor/rocketchat:models';
import { roomTypes } from 'meteor/rocketchat:utils';
FlowRouter.goToRoomById = (roomId) => {
const subscription = ChatSubscription.findOne({ rid: roomId });
if (subscription) {
RocketChat.roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams);
roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams);
}
};

@ -6,6 +6,7 @@ import { FlowRouter } from 'meteor/kadira:flow-router';
import { BlazeLayout } from 'meteor/kadira:blaze-layout';
import { Session } from 'meteor/session';
import { KonchatNotification } from 'meteor/rocketchat:ui';
import { Layout } from 'meteor/rocketchat:ui-utils';
import s from 'underscore.string';
Blaze.registerHelper('pathFor', function(path, kw) {
@ -27,7 +28,7 @@ FlowRouter.subscriptions = function() {
FlowRouter.route('/', {
name: 'index',
action() {
BlazeLayout.render('main', { modal: RocketChat.Layout.isEmbedded(), center: 'loading' });
BlazeLayout.render('main', { modal: Layout.isEmbedded(), center: 'loading' });
if (!Meteor.userId()) {
return FlowRouter.go('home');
}

@ -2,12 +2,13 @@ import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { Session } from 'meteor/session';
import { TAPi18n } from 'meteor/tap:i18n';
import { settings } from 'meteor/rocketchat:settings';
import toastr from 'toastr';
Meteor.startup(function() {
Tracker.autorun(function() {
const user = Meteor.user();
if (user && user.emails && user.emails[0] && user.emails[0].verified !== true && RocketChat.settings.get('Accounts_EmailVerification') === true && !Session.get('Accounts_EmailVerification_Warning')) {
if (user && user.emails && user.emails[0] && user.emails[0].verified !== true && settings.get('Accounts_EmailVerification') === true && !Session.get('Accounts_EmailVerification_Warning')) {
toastr.warning(TAPi18n.__('You_have_not_verified_your_email'));
Session.set('Accounts_EmailVerification_Warning', true);
}

@ -3,6 +3,8 @@ import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import { TAPi18n } from 'meteor/tap:i18n';
import { isRtl } from 'meteor/rocketchat:utils';
import { settings } from 'meteor/rocketchat:settings';
import { Users } from 'meteor/rocketchat:models';
import moment from 'moment';
const currentLanguage = new ReactiveVar();
@ -66,11 +68,11 @@ Meteor.startup(() => {
};
window.setLanguage = setLanguage;
const defaultUserLanguage = () => RocketChat.settings.get('Language') || getBrowserLanguage() || 'en';
const defaultUserLanguage = () => settings.get('Language') || getBrowserLanguage() || 'en';
window.defaultUserLanguage = defaultUserLanguage;
Tracker.autorun(() => {
const user = RocketChat.models.Users.findOne(Meteor.userId(), { fields: { language: 1 } });
const user = Users.findOne(Meteor.userId(), { fields: { language: 1 } });
setLanguage((user && user.language) || defaultUserLanguage());
});

@ -3,7 +3,10 @@ import { Tracker } from 'meteor/tracker';
import { Session } from 'meteor/session';
import { TimeSync } from 'meteor/mizzao:timesync';
import { UserPresence } from 'meteor/konecty:user-presence';
import { fireGlobalEvent } from 'meteor/rocketchat:ui';
import { fireGlobalEvent } from 'meteor/rocketchat:ui-utils';
import { settings } from 'meteor/rocketchat:settings';
import { Users } from 'meteor/rocketchat:models';
import { getUserPreference } from 'meteor/rocketchat:utils';
import toastr from 'toastr';
import hljs from 'highlight.js';
import 'highlight.js/styles/github.css';
@ -26,7 +29,7 @@ Meteor.startup(function() {
window.lastMessageWindowHistory = {};
Tracker.autorun(function(computation) {
if (!Meteor.userId() && !RocketChat.settings.get('Accounts_AllowAnonymousRead')) {
if (!Meteor.userId() && !settings.get('Accounts_AllowAnonymousRead')) {
return;
}
Meteor.subscribe('userData');
@ -39,7 +42,7 @@ Meteor.startup(function() {
if (!Meteor.userId()) {
return;
}
const user = RocketChat.models.Users.findOne(Meteor.userId(), {
const user = Users.findOne(Meteor.userId(), {
fields: {
status: 1,
'settings.preferences.idleTimeLimit': 1,
@ -51,8 +54,8 @@ Meteor.startup(function() {
return;
}
if (RocketChat.getUserPreference(user, 'enableAutoAway')) {
const idleTimeLimit = RocketChat.getUserPreference(user, 'idleTimeLimit') || 300;
if (getUserPreference(user, 'enableAutoAway')) {
const idleTimeLimit = getUserPreference(user, 'idleTimeLimit') || 300;
UserPresence.awayTime = idleTimeLimit * 1000;
} else {
delete UserPresence.awayTime;

@ -5,6 +5,8 @@ import { Session } from 'meteor/session';
import { Favico } from 'meteor/rocketchat:favico';
import { ChatSubscription } from 'meteor/rocketchat:models';
import { RoomManager, menu, fireGlobalEvent, readMessage } from 'meteor/rocketchat:ui-utils';
import { getUserPreference } from 'meteor/rocketchat:utils';
import { settings } from 'meteor/rocketchat:settings';
Meteor.startup(function() {
Tracker.autorun(function() {
@ -38,7 +40,7 @@ Meteor.startup(function() {
// Increment the total unread count.
unreadCount += subscription.unread;
if (subscription.alert === true && subscription.unreadAlert !== 'nothing') {
const userUnreadAlert = RocketChat.getUserPreference(Meteor.userId(), 'unreadAlert');
const userUnreadAlert = getUserPreference(Meteor.userId(), 'unreadAlert');
if (subscription.unreadAlert === 'all' || userUnreadAlert !== false) {
unreadAlert = '•';
}
@ -73,7 +75,7 @@ Meteor.startup(function() {
});
Tracker.autorun(function() {
const siteName = RocketChat.settings.get('Site_Name') || '';
const siteName = settings.get('Site_Name') || '';
const unread = Session.get('unread');
fireGlobalEvent('unread-changed', unread);

@ -1,10 +1,11 @@
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { Users } from 'meteor/rocketchat:models';
import moment from 'moment';
Meteor.startup(function() {
Tracker.autorun(function() {
const user = RocketChat.models.Users.findOne({ _id: Meteor.userId() }, { fields: { statusConnection: 1, utcOffset: 1 } });
const user = Users.findOne({ _id: Meteor.userId() }, { fields: { statusConnection: 1, utcOffset: 1 } });
if (user && user.statusConnection === 'online') {
const utcOffset = moment().utcOffset() / 60;
if (user.utcOffset !== utcOffset) {

@ -1,8 +1,9 @@
import { Template } from 'meteor/templating';
import { settings } from 'meteor/rocketchat:settings';
Template.main.helpers({
readReceiptsEnabled() {
if (RocketChat.settings.get('Message_Read_Receipt_Store_Users')) {
if (settings.get('Message_Read_Receipt_Store_Users')) {
return 'read-receipts-enabled';
}
},

@ -1,8 +1,9 @@
import { Template } from 'meteor/templating';
import { settings } from 'meteor/rocketchat:settings';
Template.message.helpers({
readReceipt() {
if (!RocketChat.settings.get('Message_Read_Receipt_Enabled')) {
if (!settings.get('Message_Read_Receipt_Enabled')) {
return;
}

@ -1,6 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating';
import { settings } from 'meteor/rocketchat:settings';
import moment from 'moment';
import './readReceipts.css';
@ -11,7 +12,7 @@ Template.readReceipts.helpers({
return Template.instance().readReceipts.get();
},
displayName() {
return (RocketChat.settings.get('UI_Use_Real_Name') && this.user.name) || this.user.username;
return (settings.get('UI_Use_Real_Name') && this.user.name) || this.user.username;
},
time() {
return moment(this.ts).format('L LTS');

@ -1,7 +1,8 @@
import { t } from 'meteor/rocketchat:utils';
import { modal } from 'meteor/rocketchat:ui-utils';
import { modal, MessageAction } from 'meteor/rocketchat:ui-utils';
import { settings } from 'meteor/rocketchat:settings';
RocketChat.MessageAction.addButton({
MessageAction.addButton({
id: 'receipt-detail',
icon: 'info-circled',
label: 'Message_info',
@ -20,7 +21,7 @@ RocketChat.MessageAction.addButton({
});
},
condition() {
return RocketChat.settings.get('Message_Read_Receipt_Store_Users');
return settings.get('Message_Read_Receipt_Store_Users');
},
order: 1,
group: 'menu',

@ -1,5 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { Messages } from 'meteor/rocketchat:models';
import { ReadReceipt } from '../../lib/ReadReceipt';
Meteor.methods({
@ -12,7 +12,7 @@ Meteor.methods({
throw new Meteor.Error('error-invalid-message', 'The required \'messageId\' param is missing.', { method: 'getReadReceipts' });
}
const message = RocketChat.models.Messages.findOneById(messageId);
const message = Messages.findOneById(messageId);
if (!message) {
throw new Meteor.Error('error-invalid-message', 'Invalid message', { method: 'getReadReceipts' });

@ -1,5 +0,0 @@
RocketChat.models.Messages.tryEnsureIndex({
unread: 1,
}, {
sparse: true,
});

@ -1,6 +1,8 @@
import { callbacks } from 'meteor/rocketchat:callbacks';
import { Subscriptions } from 'meteor/rocketchat:models';
import { ReadReceipt } from './lib/ReadReceipt';
RocketChat.callbacks.add('afterSaveMessage', (message, room) => {
callbacks.add('afterSaveMessage', (message, room) => {
// skips this callback if the message was edited
if (message.editedAt) {
@ -8,7 +10,7 @@ RocketChat.callbacks.add('afterSaveMessage', (message, room) => {
}
// set subscription as read right after message was sent
RocketChat.models.Subscriptions.setAsReadByRoomIdAndUserId(room._id, message.u._id);
Subscriptions.setAsReadByRoomIdAndUserId(room._id, message.u._id);
// mark message as read as well
ReadReceipt.markMessageAsReadBySender(message, room._id, message.u._id);

@ -1,4 +1,3 @@
import './dbIndexes';
import './hooks';
import './settings';

@ -1,8 +1,9 @@
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import ModelReadReceipts from '../models/ReadReceipts';
import { ReadReceipts, Subscriptions, Messages, Rooms, Users } from 'meteor/rocketchat:models';
import { settings } from 'meteor/rocketchat:settings';
const rawReadReceipts = ModelReadReceipts.model.rawCollection();
const rawReadReceipts = ReadReceipts.model.rawCollection();
// debounced function by roomId, so multiple calls within 2 seconds to same roomId runs only once
const list = {};
@ -15,17 +16,17 @@ const debounceByRoomId = function(fn) {
const updateMessages = debounceByRoomId(Meteor.bindEnvironment((roomId) => {
// @TODO maybe store firstSubscription in room object so we don't need to call the above update method
const firstSubscription = RocketChat.models.Subscriptions.getMinimumLastSeenByRoomId(roomId);
RocketChat.models.Messages.setAsRead(roomId, firstSubscription.ls);
const firstSubscription = Subscriptions.getMinimumLastSeenByRoomId(roomId);
Messages.setAsRead(roomId, firstSubscription.ls);
}));
export const ReadReceipt = {
markMessagesAsRead(roomId, userId, userLastSeen) {
if (!RocketChat.settings.get('Message_Read_Receipt_Enabled')) {
if (!settings.get('Message_Read_Receipt_Enabled')) {
return;
}
const room = RocketChat.models.Rooms.findOneById(roomId, { fields: { lm: 1 } });
const room = Rooms.findOneById(roomId, { fields: { lm: 1 } });
// if users last seen is greadebounceByRoomIdter than room's last message, it means the user already have this room marked as read
if (userLastSeen > room.lm) {
@ -33,28 +34,28 @@ export const ReadReceipt = {
}
if (userLastSeen) {
this.storeReadReceipts(RocketChat.models.Messages.findUnreadMessagesByRoomAndDate(roomId, userLastSeen), roomId, userId);
this.storeReadReceipts(Messages.findUnreadMessagesByRoomAndDate(roomId, userLastSeen), roomId, userId);
}
updateMessages(roomId);
},
markMessageAsReadBySender(message, roomId, userId) {
if (!RocketChat.settings.get('Message_Read_Receipt_Enabled')) {
if (!settings.get('Message_Read_Receipt_Enabled')) {
return;
}
// this will usually happens if the message sender is the only one on the room
const firstSubscription = RocketChat.models.Subscriptions.getMinimumLastSeenByRoomId(roomId);
const firstSubscription = Subscriptions.getMinimumLastSeenByRoomId(roomId);
if (message.unread && message.ts < firstSubscription.ls) {
RocketChat.models.Messages.setAsReadById(message._id, firstSubscription.ls);
Messages.setAsReadById(message._id, firstSubscription.ls);
}
this.storeReadReceipts([{ _id: message._id }], roomId, userId);
},
storeReadReceipts(messages, roomId, userId) {
if (RocketChat.settings.get('Message_Read_Receipt_Store_Users')) {
if (settings.get('Message_Read_Receipt_Store_Users')) {
const ts = new Date();
const receipts = messages.map((message) => ({
_id: Random.id(),
@ -77,9 +78,9 @@ export const ReadReceipt = {
},
getReceipts(message) {
return ModelReadReceipts.findByMessageId(message._id).map((receipt) => ({
return ReadReceipts.findByMessageId(message._id).map((receipt) => ({
...receipt,
user: RocketChat.models.Users.findOneById(receipt.userId, { fields: { username: 1, name: 1 } }),
user: Users.findOneById(receipt.userId, { fields: { username: 1, name: 1 } }),
}));
},
};

@ -1,10 +1,12 @@
RocketChat.settings.add('Message_Read_Receipt_Enabled', false, {
import { settings } from 'meteor/rocketchat:settings';
settings.add('Message_Read_Receipt_Enabled', false, {
group: 'Message',
type: 'boolean',
public: true,
});
RocketChat.settings.add('Message_Read_Receipt_Store_Users', false, {
settings.add('Message_Read_Receipt_Store_Users', false, {
group: 'Message',
type: 'boolean',
public: true,

@ -5,6 +5,7 @@ import { Tracker } from 'meteor/tracker';
import { Template } from 'meteor/templating';
import { t } from 'meteor/rocketchat:utils';
import { modal, SideNav } from 'meteor/rocketchat:ui-utils';
import { hasAllPermission } from 'meteor/rocketchat:authorization';
import toastr from 'toastr';
import moment from 'moment';
@ -14,7 +15,7 @@ const PersonalAccessTokens = new Mongo.Collection('personal_access_tokens');
Template.accountTokens.helpers({
isAllowed() {
return RocketChat.authz.hasAllPermission(['create-personal-access-tokens']);
return hasAllPermission(['create-personal-access-tokens']);
},
tokens() {
return (PersonalAccessTokens.find({}).fetch()[0] && PersonalAccessTokens.find({}).fetch()[0].tokens) || [];

@ -1,18 +1,20 @@
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { Accounts } from 'meteor/accounts-base';
import { hasPermission } from 'meteor/rocketchat:authorization';
import { Users } from 'meteor/rocketchat:models';
Meteor.methods({
'personalAccessTokens:generateToken'({ tokenName }) {
if (!Meteor.userId()) {
throw new Meteor.Error('not-authorized', 'Not Authorized', { method: 'personalAccessTokens:generateToken' });
}
if (!RocketChat.authz.hasPermission(Meteor.userId(), 'create-personal-access-tokens')) {
if (!hasPermission(Meteor.userId(), 'create-personal-access-tokens')) {
throw new Meteor.Error('not-authorized', 'Not Authorized', { method: 'personalAccessTokens:generateToken' });
}
const token = Random.secret();
const tokenExist = RocketChat.models.Users.findPersonalAccessTokenByTokenNameAndUserId({
const tokenExist = Users.findPersonalAccessTokenByTokenNameAndUserId({
userId: Meteor.userId(),
tokenName,
});
@ -20,7 +22,7 @@ Meteor.methods({
throw new Meteor.Error('error-token-already-exists', 'A token with this name already exists', { method: 'personalAccessTokens:generateToken' });
}
RocketChat.models.Users.addPersonalAccessTokenToUser({
Users.addPersonalAccessTokenToUser({
userId: Meteor.userId(),
loginTokenObject: {
hashedToken: Accounts._hashLoginToken(token),

@ -1,15 +1,17 @@
import { Meteor } from 'meteor/meteor';
import { hasPermission } from 'meteor/rocketchat:authorization';
import { Users } from 'meteor/rocketchat:models';
Meteor.methods({
'personalAccessTokens:regenerateToken'({ tokenName }) {
if (!Meteor.userId()) {
throw new Meteor.Error('not-authorized', 'Not Authorized', { method: 'personalAccessTokens:regenerateToken' });
}
if (!RocketChat.authz.hasPermission(Meteor.userId(), 'create-personal-access-tokens')) {
if (!hasPermission(Meteor.userId(), 'create-personal-access-tokens')) {
throw new Meteor.Error('not-authorized', 'Not Authorized', { method: 'personalAccessTokens:regenerateToken' });
}
const tokenExist = RocketChat.models.Users.findPersonalAccessTokenByTokenNameAndUserId({
const tokenExist = Users.findPersonalAccessTokenByTokenNameAndUserId({
userId: Meteor.userId(),
tokenName,
});

@ -1,21 +1,23 @@
import { Meteor } from 'meteor/meteor';
import { hasPermission } from 'meteor/rocketchat:authorization';
import { Users } from 'meteor/rocketchat:models';
Meteor.methods({
'personalAccessTokens:removeToken'({ tokenName }) {
if (!Meteor.userId()) {
throw new Meteor.Error('not-authorized', 'Not Authorized', { method: 'personalAccessTokens:removeToken' });
}
if (!RocketChat.authz.hasPermission(Meteor.userId(), 'create-personal-access-tokens')) {
if (!hasPermission(Meteor.userId(), 'create-personal-access-tokens')) {
throw new Meteor.Error('not-authorized', 'Not Authorized', { method: 'personalAccessTokens:removeToken' });
}
const tokenExist = RocketChat.models.Users.findPersonalAccessTokenByTokenNameAndUserId({
const tokenExist = Users.findPersonalAccessTokenByTokenNameAndUserId({
userId: Meteor.userId(),
tokenName,
});
if (!tokenExist) {
throw new Meteor.Error('error-token-does-not-exists', 'Token does not exist', { method: 'personalAccessTokens:removeToken' });
}
RocketChat.models.Users.removePersonalAccessTokenOfUser({
Users.removePersonalAccessTokenOfUser({
userId: Meteor.userId(),
loginTokenObject: {
type: 'personalAccessToken',

@ -1,5 +1,4 @@
import './api/methods';
import './models';
import './publications';

@ -1,39 +0,0 @@
RocketChat.models.Users.getLoginTokensByUserId = function(userId) {
const query = {
'services.resume.loginTokens.type': {
$exists: true,
$eq: 'personalAccessToken',
},
_id: userId,
};
return this.find(query, { fields: { 'services.resume.loginTokens': 1 } });
};
RocketChat.models.Users.addPersonalAccessTokenToUser = function({ userId, loginTokenObject }) {
return this.update(userId, {
$push: {
'services.resume.loginTokens': loginTokenObject,
},
});
};
RocketChat.models.Users.removePersonalAccessTokenOfUser = function({ userId, loginTokenObject }) {
return this.update(userId, {
$pull: {
'services.resume.loginTokens': loginTokenObject,
},
});
};
RocketChat.models.Users.findPersonalAccessTokenByTokenNameAndUserId = function({ userId, tokenName }) {
const query = {
'services.resume.loginTokens': {
$elemMatch: { name: tokenName, type: 'personalAccessToken' },
},
_id: userId,
};
return this.findOne(query);
};

@ -1,10 +1,12 @@
import { Meteor } from 'meteor/meteor';
import { hasPermission } from 'meteor/rocketchat:authorization';
import { Users } from 'meteor/rocketchat:models';
Meteor.publish('personalAccessTokens', function() {
if (!this.userId) {
return this.ready();
}
if (!RocketChat.authz.hasPermission(this.userId, 'create-personal-access-tokens')) {
if (!hasPermission(this.userId, 'create-personal-access-tokens')) {
return this.ready();
}
const self = this;
@ -15,7 +17,7 @@ Meteor.publish('personalAccessTokens', function() {
createdAt: loginToken.createdAt,
lastTokenPart: loginToken.lastTokenPart,
}));
const handle = RocketChat.models.Users.getLoginTokensByUserId(this.userId).observeChanges({
const handle = Users.getLoginTokensByUserId(this.userId).observeChanges({
added(id, fields) {
self.added('personal_access_tokens', id, { tokens: getFieldsToPublish(fields) });
},

@ -30,6 +30,7 @@ import LivechatOfficeHour from './models/LivechatOfficeHour';
import LivechatPageVisited from './models/LivechatPageVisited';
import LivechatTrigger from './models/LivechatTrigger';
import LivechatVisitors from './models/LivechatVisitors';
import ReadReceipts from './models/ReadReceipts';
export {
Base,
@ -64,4 +65,5 @@ export {
LivechatPageVisited,
LivechatTrigger,
LivechatVisitors,
ReadReceipts,
};

@ -23,6 +23,7 @@ export class Messages extends Base {
this.tryEnsureIndex({ snippeted: 1 }, { sparse: 1 });
this.tryEnsureIndex({ location: '2dsphere' });
this.tryEnsureIndex({ slackBotId: 1, slackTs: 1 }, { sparse: 1 });
this.tryEnsureIndex({ unread: 1 }, { sparse: true });
this.loadSettings();
}

@ -1,4 +1,6 @@
class ModelReadReceipts extends RocketChat.models._Base {
import { Base } from './_Base';
export class ReadReceipts extends Base {
constructor(...args) {
super(...args);
@ -16,4 +18,4 @@ class ModelReadReceipts extends RocketChat.models._Base {
}
}
export default new ModelReadReceipts('message_read_receipt');
export default new ReadReceipts('message_read_receipt');

@ -27,6 +27,45 @@ export class Users extends Base {
});
}
getLoginTokensByUserId(userId) {
const query = {
'services.resume.loginTokens.type': {
$exists: true,
$eq: 'personalAccessToken',
},
_id: userId,
};
return this.find(query, { fields: { 'services.resume.loginTokens': 1 } });
}
addPersonalAccessTokenToUser({ userId, loginTokenObject }) {
return this.update(userId, {
$push: {
'services.resume.loginTokens': loginTokenObject,
},
});
}
removePersonalAccessTokenOfUser({ userId, loginTokenObject }) {
return this.update(userId, {
$pull: {
'services.resume.loginTokens': loginTokenObject,
},
});
}
findPersonalAccessTokenByTokenNameAndUserId({ userId, tokenName }) {
const query = {
'services.resume.loginTokens': {
$elemMatch: { name: tokenName, type: 'personalAccessToken' },
},
_id: userId,
};
return this.findOne(query);
}
setOperator(_id, operator) {
const update = {
$set: {

Loading…
Cancel
Save