Skip to content

Commit

Permalink
Remove dependency of RC namespace in rc-message-pin and message-snip…
Browse files Browse the repository at this point in the history
…pet (#13343)

* 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-api/helpers and api.js (#13273)

* Move RestAPI client to rc-api package

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

*  Remove dependency of RC namespace on half of api files (#13275)

* Move RestAPI client to rc-api package

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

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api (#13277)

* Move RestAPI client to rc-api package

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

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

* Remove dependency of RC namespace in rc-api (#13278)

* Move RestAPI client to rc-api package

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

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

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

* Move processWebhookMessage function to rc-lib package

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

* Remove namespace in the new livechat endpoint

*  Remove dependency of RC namespace in rc-graphql (#13279)

* Move RestAPI client to rc-api package

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

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

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

* Move processWebhookMessage function to rc-lib package

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

* Remove dependency of RC namespace in rc-graphql

* Fix import from wrong package

* Remove namespace in the new livechat endpoint

* Remove dependency of RC namespace in rc-importer (#13280)

* Move RestAPI client to rc-api package

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

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

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

* Move processWebhookMessage function to rc-lib package

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

* Remove dependency of RC namespace in rc-graphql

* Fix import from wrong package

* Remove dependency of RC namespace in rc-importer

* Remove namespace in the new livechat endpoint

*  Remove dependency of RC namespace in rc-ldap, katex and issue-links (#13281)

* Move RestAPI client to rc-api package

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

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

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

* Move processWebhookMessage function to rc-lib package

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

* Remove dependency of RC namespace in rc-graphql

* Fix import from wrong package

* Remove dependency of RC namespace in rc-importer

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

* Remove dependency of RC namespace in rc-katex

* Move templateVarHandler fn to rc-utils

* Remove dependency of RC namespace in rc-ldap

* Fix templateVarHandler that was in wrong folder

* Remove namespace in the new livechat endpoint

*  Remove dependency of RC namespace in rc-livestream and rc-mail-messages (#13320)

* Move RestAPI client to rc-api package

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

* Remove dependency of RC namespace on half of api files

* Partial Remove dependency of RC namespace in rc-api

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

* Move processWebhookMessage function to rc-lib package

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

* Remove dependency of RC namespace in rc-graphql

* Fix import from wrong package

* Remove dependency of RC namespace in rc-importer

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

* Remove dependency of RC namespace in rc-katex

* Move templateVarHandler fn to rc-utils

* Remove dependency of RC namespace in rc-ldap

* Remove dependency of RC namespace in rc-livestream

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

* Fix templateVarHandler that was in wrong folder

* Remove namespace in the new livechat endpoint
  • Loading branch information
MarcosSpessatto authored and rodrigok committed Feb 14, 2019
1 parent 8365162 commit 0d42efc
Show file tree
Hide file tree
Showing 43 changed files with 235 additions and 199 deletions.
7 changes: 4 additions & 3 deletions packages/rocketchat-mapview/client/mapview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { settings } from 'meteor/rocketchat:settings';
import { callbacks } from 'meteor/rocketchat:callbacks';
/*
* MapView is a named function that will replace geolocation in messages with a Google Static Map
* @param {Object} message - The message object
Expand All @@ -8,7 +9,7 @@ import { RocketChat } from 'meteor/rocketchat:lib';
function MapView(message) {

// get MapView settings
const mv_googlekey = RocketChat.settings.get('MapView_GMapsAPIKey');
const mv_googlekey = settings.get('MapView_GMapsAPIKey');

if (message.location) {

Expand All @@ -26,4 +27,4 @@ function MapView(message) {
return message;
}

RocketChat.callbacks.add('renderMessage', MapView, RocketChat.callbacks.priority.HIGH, 'mapview');
callbacks.add('renderMessage', MapView, callbacks.priority.HIGH, 'mapview');
3 changes: 2 additions & 1 deletion packages/rocketchat-mapview/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'ecmascript',
'rocketchat:lib',
'rocketchat:settings',
'rocketchat:callbacks',
'tap:i18n',
]);
api.mainModule('client/index.js', 'client');
Expand Down
6 changes: 3 additions & 3 deletions packages/rocketchat-mapview/server/settings.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { settings } from 'meteor/rocketchat:settings';

Meteor.startup(function() {
RocketChat.settings.add('MapView_Enabled', false, { type: 'boolean', group: 'Message', section: 'Google Maps', public: true, i18nLabel: 'MapView_Enabled', i18nDescription: 'MapView_Enabled_Description' });
return RocketChat.settings.add('MapView_GMapsAPIKey', '', { type: 'string', group: 'Message', section: 'Google Maps', public: true, i18nLabel: 'MapView_GMapsAPIKey', i18nDescription: 'MapView_GMapsAPIKey_Description' });
settings.add('MapView_Enabled', false, { type: 'boolean', group: 'Message', section: 'Google Maps', public: true, i18nLabel: 'MapView_Enabled', i18nDescription: 'MapView_Enabled_Description' });
return settings.add('MapView_GMapsAPIKey', '', { type: 'string', group: 'Message', section: 'Google Maps', public: true, i18nLabel: 'MapView_GMapsAPIKey', i18nDescription: 'MapView_GMapsAPIKey_Description' });
});
5 changes: 2 additions & 3 deletions packages/rocketchat-mentions-flextab/client/actionButton.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';
import { RoomHistoryManager } from 'meteor/rocketchat:ui';
import { MessageAction, RoomHistoryManager } from 'meteor/rocketchat:ui-utils';

Meteor.startup(function() {
RocketChat.MessageAction.addButton({
MessageAction.addButton({
id: 'jump-to-message',
icon: 'jump',
label: 'Jump_to_message',
Expand Down
4 changes: 2 additions & 2 deletions packages/rocketchat-mentions-flextab/client/tabBar.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { TabBar } from 'meteor/rocketchat:ui-utils';

Meteor.startup(function() {
return RocketChat.TabBar.addButton({
return TabBar.addButton({
groups: ['channel', 'group'],
id: 'mentions',
i18nTitle: 'Mentions',
Expand Down
3 changes: 2 additions & 1 deletion packages/rocketchat-mentions-flextab/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Package.onUse(function(api) {
'mongo',
'ecmascript',
'less',
'rocketchat:lib',
'rocketchat:models',
'rocketchat:ui-utils',
'templating',
]);
api.addFiles('client/views/stylesheets/mentionsFlexTab.less', 'client');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Users, Messages } from 'meteor/rocketchat:models';

Meteor.publish('mentionedMessages', function(rid, limit = 50) {
if (!this.userId) {
return this.ready();
}
const publication = this;
const user = RocketChat.models.Users.findOneById(this.userId);
const user = Users.findOneById(this.userId);
if (!user) {
return this.ready();
}
if (!Meteor.call('canAccessRoom', rid, this.userId)) {
return this.ready();
}
const cursorHandle = RocketChat.models.Messages.findVisibleByMentionAndRoomId(user.username, rid, {
const cursorHandle = Messages.findVisibleByMentionAndRoomId(user.username, rid, {
sort: {
ts: -1,
},
Expand Down
11 changes: 6 additions & 5 deletions packages/rocketchat-mentions/client/client.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { callbacks } from 'meteor/rocketchat:callbacks';
import { settings } from 'meteor/rocketchat:settings';
import Mentions from '../lib/Mentions';

const MentionsClient = new Mentions({
pattern() {
return RocketChat.settings.get('UTF8_Names_Validation');
return settings.get('UTF8_Names_Validation');
},
useRealName() {
return RocketChat.settings.get('UI_Use_Real_Name');
return settings.get('UI_Use_Real_Name');
},
me() {
const me = Meteor.user();
return me && me.username;
},
});

RocketChat.callbacks.add('renderMessage', (message) => MentionsClient.parse(message), RocketChat.callbacks.priority.MEDIUM, 'mentions-message');
RocketChat.callbacks.add('renderMentions', (message) => MentionsClient.parse(message), RocketChat.callbacks.priority.MEDIUM, 'mentions-mentions');
callbacks.add('renderMessage', (message) => MentionsClient.parse(message), callbacks.priority.MEDIUM, 'mentions-message');
callbacks.add('renderMentions', (message) => MentionsClient.parse(message), callbacks.priority.MEDIUM, 'mentions-mentions');
5 changes: 4 additions & 1 deletion packages/rocketchat-mentions/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'ecmascript',
'rocketchat:lib',
'rocketchat:settings',
'rocketchat:callbacks',
'rocketchat:notifications',
'rocketchat:models',
]);
api.mainModule('client/index.js', 'client');
api.mainModule('server/index.js', 'server');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Rooms, Users, Messages } from 'meteor/rocketchat:models';

Meteor.methods({
getUserMentionsByChannel({ roomId, options }) {
Expand All @@ -10,14 +10,14 @@ Meteor.methods({
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'getUserMentionsByChannel' });
}

const room = RocketChat.models.Rooms.findOneById(roomId);
const room = Rooms.findOneById(roomId);

if (!room) {
throw new Meteor.Error('error-invalid-room', 'Invalid room', { method: 'getUserMentionsByChannel' });
}

const user = RocketChat.models.Users.findOneById(Meteor.userId());
const user = Users.findOneById(Meteor.userId());

return RocketChat.models.Messages.findVisibleByMentionAndRoomId(user.username, roomId, options).fetch();
return Messages.findVisibleByMentionAndRoomId(user.username, roomId, options).fetch();
},
});
19 changes: 11 additions & 8 deletions packages/rocketchat-mentions/server/server.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { settings } from 'meteor/rocketchat:settings';
import { callbacks } from 'meteor/rocketchat:callbacks';
import { Notifications } from 'meteor/rocketchat:notifications';
import { Users, Subscriptions, Rooms } from 'meteor/rocketchat:models';
import _ from 'underscore';
import MentionsServer from './Mentions';

const mention = new MentionsServer({
pattern: () => RocketChat.settings.get('UTF8_Names_Validation'),
messageMaxAll: () => RocketChat.settings.get('Message_MaxAll'),
pattern: () => settings.get('UTF8_Names_Validation'),
messageMaxAll: () => settings.get('Message_MaxAll'),
getUsers: (usernames) => Meteor.users.find({ username: { $in: _.unique(usernames) } }, { fields: { _id: true, username: true, name: 1 } }).fetch(),
getUser: (userId) => RocketChat.models.Users.findOneById(userId),
getTotalChannelMembers: (rid) => RocketChat.models.Subscriptions.findByRoomId(rid).count(),
getChannels: (channels) => RocketChat.models.Rooms.find({ name: { $in: _.unique(channels) }, t: 'c' }, { fields: { _id: 1, name: 1 } }).fetch(),
getUser: (userId) => Users.findOneById(userId),
getTotalChannelMembers: (rid) => Subscriptions.findByRoomId(rid).count(),
getChannels: (channels) => Rooms.find({ name: { $in: _.unique(channels) }, t: 'c' }, { fields: { _id: 1, name: 1 } }).fetch(),
onMaxRoomMembersExceeded({ sender, rid }) {
// Get the language of the user for the error notification.
const { language } = this.getUser(sender._id);
const msg = TAPi18n.__('Group_mentions_disabled_x_members', { total: this.messageMaxAll }, language);

RocketChat.Notifications.notifyUser(sender._id, 'message', {
Notifications.notifyUser(sender._id, 'message', {
_id: Random.id(),
rid,
ts: new Date,
Expand All @@ -32,4 +35,4 @@ const mention = new MentionsServer({
});
},
});
RocketChat.callbacks.add('beforeSaveMessage', (message) => mention.execute(message), RocketChat.callbacks.priority.HIGH, 'mentions');
callbacks.add('beforeSaveMessage', (message) => mention.execute(message), callbacks.priority.HIGH, 'mentions');
1 change: 0 additions & 1 deletion packages/rocketchat-message-action/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Package.onUse(function(api) {
api.use([
'templating',
'ecmascript',
'rocketchat:lib',
]);
api.addFiles('client/stylesheets/messageAction.css', 'client');
api.mainModule('client/index.js', 'client');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Meteor } from 'meteor/meteor';
import { DateFormat } from 'meteor/rocketchat:lib';
import { fixCordova } from 'meteor/rocketchat:lazy-load';
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';
import { getUserPreference } from 'meteor/rocketchat:utils';
import { Users } from 'meteor/rocketchat:models';
import { renderMessageBody } from 'meteor/rocketchat:ui-utils';

const colors = {
Expand All @@ -28,11 +29,11 @@ Template.messageAttachment.helpers({
},
loadImage() {
if (this.downloadImages !== true) {
const user = RocketChat.models.Users.findOne({ _id: Meteor.userId() }, { fields: { 'settings.autoImageLoad' : 1 } });
if (RocketChat.getUserPreference(user, 'autoImageLoad') === false) {
const user = Users.findOne({ _id: Meteor.userId() }, { fields: { 'settings.autoImageLoad' : 1 } });
if (getUserPreference(user, 'autoImageLoad') === false) {
return false;
}
if (Meteor.Device.isPhone() && RocketChat.getUserPreference(user, 'saveMobileBandwidth') !== true) {
if (Meteor.Device.isPhone() && getUserPreference(user, 'saveMobileBandwidth') !== true) {
return false;
}
}
Expand All @@ -54,7 +55,7 @@ Template.messageAttachment.helpers({
if (this.collapsed != null) {
return this.collapsed;
} else {
return RocketChat.getUserPreference(Meteor.userId(), 'collapseMediaByDefault') === true;
return getUserPreference(Meteor.userId(), 'collapseMediaByDefault') === true;
}
},
time() {
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-message-attachments/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Package.onUse(function(api) {
'rocketchat:e2e',
'rocketchat:ui-message',
'rocketchat:ui-utils',
'rocketchat:utils',
'rocketchat:models',
]);
api.addFiles('client/stylesheets/messageAttachments.css', 'client');
api.mainModule('client/index.js', 'client');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Meteor } from 'meteor/meteor';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { RocketChat, handleError } from 'meteor/rocketchat:lib';
import { RoomManager, ChatSubscription } from 'meteor/rocketchat:ui';
import { RoomManager, MessageAction } from 'meteor/rocketchat:ui-utils';
import { handleError } from 'meteor/rocketchat:utils';
import { ChatSubscription } from 'meteor/rocketchat:models';

Meteor.startup(() => {
RocketChat.MessageAction.addButton({
MessageAction.addButton({
id: 'mark-message-as-unread',
icon: 'flag',
label: 'Mark_as_unread',
Expand Down
5 changes: 3 additions & 2 deletions packages/rocketchat-message-mark-as-unread/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'ecmascript',
'rocketchat:lib',
'rocketchat:logger',
'rocketchat:ui',
'rocketchat:models',
'rocketchat:ui-utils',
'rocketchat:utils',
'templating',
]);
api.mainModule('client/index.js', 'client');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Messages, Subscriptions } from 'meteor/rocketchat:models';
import logger from './logger';

Meteor.methods({
Expand All @@ -12,7 +12,7 @@ Meteor.methods({
}

if (room) {
const lastMessage = RocketChat.models.Messages.findVisibleByRoomId(room, { limit: 1, sort: { ts: -1 } }).fetch()[0];
const lastMessage = Messages.findVisibleByRoomId(room, { limit: 1, sort: { ts: -1 } }).fetch()[0];

if (lastMessage == null) {
throw new Meteor.Error('error-action-not-allowed', 'Not allowed', {
Expand All @@ -21,10 +21,10 @@ Meteor.methods({
});
}

return RocketChat.models.Subscriptions.setAsUnreadByRoomIdAndUserId(lastMessage.rid, userId, lastMessage.ts);
return Subscriptions.setAsUnreadByRoomIdAndUserId(lastMessage.rid, userId, lastMessage.ts);
}

const originalMessage = RocketChat.models.Messages.findOneById(firstUnreadMessage._id, {
const originalMessage = Messages.findOneById(firstUnreadMessage._id, {
fields: {
u: 1,
rid: 1,
Expand All @@ -38,11 +38,11 @@ Meteor.methods({
action: 'Unread_messages',
});
}
const lastSeen = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(originalMessage.rid, userId).ls;
const lastSeen = Subscriptions.findOneByRoomIdAndUserId(originalMessage.rid, userId).ls;
if (firstUnreadMessage.ts >= lastSeen) {
return logger.connection.debug('Provided message is already marked as unread');
}
logger.connection.debug(`Updating unread message of ${ originalMessage.ts } as the first unread`);
return RocketChat.models.Subscriptions.setAsUnreadByRoomIdAndUserId(originalMessage.rid, userId, originalMessage.ts);
return Subscriptions.setAsUnreadByRoomIdAndUserId(originalMessage.rid, userId, originalMessage.ts);
},
});
Loading

0 comments on commit 0d42efc

Please sign in to comment.