Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency of RC namespace in root server folder - step 1 #13390

Merged
merged 192 commits into from
Feb 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
171754e
Remove some dependencies inside rocketchat-lib/client (#13210)
MarcosSpessatto Jan 21, 2019
f536345
Remove some dependencies inside rocketchat-lib/lib (#13212)
MarcosSpessatto Jan 21, 2019
118634c
Remove some dependencies inside rocketchat-lib/server/functions (#13214)
MarcosSpessatto Jan 22, 2019
2bf63fb
Remove some dependencies inside rocketchat-lib/server/lib (#13217)
MarcosSpessatto Jan 22, 2019
3f1451f
Remove some dependencies inside rocketchat-lib/server/methods (#13218)
MarcosSpessatto Jan 22, 2019
23388c4
Remove some dependencies inside rocketchat-lib/server/startup, public…
MarcosSpessatto Jan 22, 2019
23547e9
Remove duplicated server settings (#13223)
MarcosSpessatto Jan 22, 2019
45b5dd0
Export functions and lib function of rc-lib but keep it inside RC na…
MarcosSpessatto Jan 23, 2019
a233ad7
Import variables from functions and lib to remove RC namespace depen…
MarcosSpessatto Jan 23, 2019
96f6fa1
Remove dependency of RC namespace in rc-sandstorm (#13227)
MarcosSpessatto Jan 23, 2019
4a3c69a
Remove dependency of RC namespace in chatpal-search (#13231)
MarcosSpessatto Jan 23, 2019
54b152f
Remove dependency of RC namespace in meteor saml (#13233)
MarcosSpessatto Jan 23, 2019
b3906fa
Remove dependency of RC namespace in rc-theme (#13234)
MarcosSpessatto Jan 23, 2019
9bd766a
Remove dependency of RC namespace in rc-2fa (#13235)
MarcosSpessatto Jan 23, 2019
86ae7c8
Remove dependency of RC namespace in rc-action-links (#13236)
MarcosSpessatto Jan 23, 2019
ed81de8
Remove dependency of RC namespace in rc-analytics and rc-assets (#13…
MarcosSpessatto Jan 24, 2019
a5e4f43
Remove dependency of RC namespace in rc-markdown, rc-autolinker and …
MarcosSpessatto Jan 24, 2019
258d258
Remove dependency of RC namespace in rc-blockstack, bot-helpers and …
MarcosSpessatto Jan 24, 2019
b9e1538
Remove dependency of RC namespace in rc-channel-settings (#13251)
MarcosSpessatto Jan 24, 2019
aff4cfe
Remove dependency of RC namespace in rc-channel-mail-messages and cl…
MarcosSpessatto Jan 24, 2019
02436be
Remove dependency of RC namespace in rc-colors, cors, crowd and dolp…
MarcosSpessatto Jan 24, 2019
5528c0f
Remove dependency of RC namespace in rc-emoji-custom and drupal (#13…
MarcosSpessatto Jan 25, 2019
c70a809
Remove dependency of RC namespace in rc-emojione, error-handler, gh-e…
MarcosSpessatto Jan 25, 2019
ffa0945
Remove dependency of RC namespace in rc-google-natural-language, gran…
MarcosSpessatto Jan 25, 2019
9ea6306
Remove dependency of RC namespace in rc-iframe-login and all imports…
MarcosSpessatto Jan 25, 2019
801ed01
Move RestAPI client to rc-api package
MarcosSpessatto Jan 28, 2019
1238c2c
Remove dependency of RC namespace in rc-api/helpers and api.js
MarcosSpessatto Jan 28, 2019
dc8f615
Remove dependency of RC namespace on half of api files
MarcosSpessatto Jan 28, 2019
c6db2d5
Partial Remove dependency of RC namespace in rc-api
MarcosSpessatto Jan 28, 2019
06f62e6
import API where it was being used by the RC namespace
MarcosSpessatto Jan 28, 2019
cd1930c
Move processWebhookMessage function to rc-lib package
MarcosSpessatto Jan 28, 2019
d7eab39
Remove API from RC namespace and import missing function that was bei…
MarcosSpessatto Jan 28, 2019
59bbccc
Remove dependency of RC namespace in rc-graphql
MarcosSpessatto Jan 28, 2019
e90ab24
Fix import from wrong package
MarcosSpessatto Jan 28, 2019
fd4f74c
Remove dependency of RC namespace in rc-importer
MarcosSpessatto Jan 28, 2019
58ad493
Remove dependency of RC namespace in rc-issue-links
MarcosSpessatto Jan 28, 2019
5783786
Remove dependency of RC namespace in rc-katex
MarcosSpessatto Jan 28, 2019
e9be3a4
Move templateVarHandler fn to rc-utils
MarcosSpessatto Jan 28, 2019
406e037
Remove dependency of RC namespace in rc-ldap
MarcosSpessatto Jan 28, 2019
0206d28
Remove dependency of RC namespace in rc-livestream
MarcosSpessatto Feb 1, 2019
b6b980b
Remove dependency of RC namespace in rc-mail-messages
MarcosSpessatto Feb 1, 2019
7c7b063
Remove dependency of RC namespace in rc-mapview
MarcosSpessatto Feb 1, 2019
e08ad7e
Remove dependency of RC namespace in rc-mentions
MarcosSpessatto Feb 1, 2019
8bb2a96
Remove dependency of RC namespace in rc-mentions-flextab
MarcosSpessatto Feb 1, 2019
ea2b699
Remove depedency of RC namespace in rc-message-attachements
MarcosSpessatto Feb 1, 2019
4da85d9
Remove dependdency of RC namespace in rc-message-mark-as-unread
MarcosSpessatto Feb 1, 2019
1717135
Remove dependency of RC namespace in rc-message-pin
MarcosSpessatto Feb 1, 2019
6733112
Fix templateVarHandler that was in wrong folder
MarcosSpessatto Feb 1, 2019
bff0955
Merge branch 'develop' into depackaging
MarcosSpessatto Feb 4, 2019
b42676d
Merge branch 'depackaging' into globals/api-wave-1
MarcosSpessatto Feb 4, 2019
9db42c7
Merge branch 'globals/api-wave-1' into globals/api-wave-2
MarcosSpessatto Feb 4, 2019
d9635ae
Merge branch 'globals/api-wave-2' into globals/api-wave-3
MarcosSpessatto Feb 4, 2019
5560fb1
Merge branch 'globals/api-wave-3' into globals/api-wave-4
MarcosSpessatto Feb 4, 2019
765a43a
Merge branch 'globals/api-wave-4' into globals/graphql
MarcosSpessatto Feb 4, 2019
b567143
Merge branch 'globals/graphql' into globals/importer
MarcosSpessatto Feb 4, 2019
9fdf8a1
Merge branch 'globals/importer' into globals/issue-katex-ldap
MarcosSpessatto Feb 4, 2019
e9d857d
Merge branch 'globals/issue-katex-ldap' into globals/livestream-mail-…
MarcosSpessatto Feb 4, 2019
edf0e3d
Merge branch 'globals/livestream-mail-messages' into globals/mapview-…
MarcosSpessatto Feb 4, 2019
d39b6cd
Remove namespace in the new livechat endpoint
MarcosSpessatto Feb 4, 2019
e08efcd
Merge branch 'globals/api-wave-4' into globals/graphql
MarcosSpessatto Feb 4, 2019
20a71ff
Merge branch 'globals/graphql' into globals/importer
MarcosSpessatto Feb 4, 2019
77d0e2e
Merge branch 'globals/importer' into globals/issue-katex-ldap
MarcosSpessatto Feb 4, 2019
b588332
Merge branch 'globals/issue-katex-ldap' into globals/livestream-mail-…
MarcosSpessatto Feb 4, 2019
e9a51ab
Merge branch 'globals/livestream-mail-messages' into globals/mapview-…
MarcosSpessatto Feb 4, 2019
0d397c8
Merge branch 'globals/mapview-mentions' into globals/message
MarcosSpessatto Feb 4, 2019
1ae8bfd
Remove dependency of RC namespace in rc-message-snippet
MarcosSpessatto Feb 4, 2019
3bd702f
Remove dependency of RC namespace in rc-message-star
MarcosSpessatto Feb 4, 2019
0dbc8ed
Remove dependency of RC namespace in rc-oauth2
MarcosSpessatto Feb 4, 2019
584d087
Remove dependency of RC namespace in rc-oembed
MarcosSpessatto Feb 4, 2019
c06f9e1
Remove dependency of RC namespace in rc-otr
MarcosSpessatto Feb 4, 2019
b807e99
Remove dependency of RC namespace in rc-reactions
MarcosSpessatto Feb 4, 2019
87a39cf
Remove dependency of RC namespace in rc-retention-policy
MarcosSpessatto Feb 4, 2019
923b584
Remove dependency of RC namespace in rc-earch
MarcosSpessatto Feb 4, 2019
b2db169
Remove dependency of RC namespace in rc-setup-wizard
MarcosSpessatto Feb 4, 2019
b7174f8
Remove dependency of RC namespace in rc-slackbridge
MarcosSpessatto Feb 4, 2019
9cbf738
Remove dependency of Rc namespace in slashcommands-asciiarts
MarcosSpessatto Feb 4, 2019
3dd76ba
Remove depedency of RC namespace in rc-slash-archiveroom
MarcosSpessatto Feb 4, 2019
ca9c074
Remove dependency of RC namespace in rc-slash-create
MarcosSpessatto Feb 4, 2019
c4354d0
Remove dependency of RC namespace in rc-slash-help
MarcosSpessatto Feb 4, 2019
c0ede55
Remove dependency of RC namespace in rc-slash-hide
MarcosSpessatto Feb 4, 2019
b6fd2d5
Remove dependency of RC namespace in rc-slash-invite
MarcosSpessatto Feb 4, 2019
c532fad
Remove dependency of RC namespace in rc-slash-inviteall
MarcosSpessatto Feb 4, 2019
40fb545
Remove dependency of RC namespace in rc-slash-join
MarcosSpessatto Feb 5, 2019
e24096b
Remove dependency of RC namespace in rc-slash-kick
MarcosSpessatto Feb 5, 2019
1aa0f73
Remove dependency of RC namespace in rc-slash-leave
MarcosSpessatto Feb 5, 2019
74fc80c
Remove dependency of RC namespace in rc-slash-me
MarcosSpessatto Feb 5, 2019
5180629
Remove dependency of RC namespace in rc-slash-msg
MarcosSpessatto Feb 5, 2019
b3c4be2
Remove dependency of RC namespace in rc-slash-mute
MarcosSpessatto Feb 5, 2019
baa9aec
Remove dependency of RC namespace in rc-slash-open
MarcosSpessatto Feb 5, 2019
d75940e
Remove dependency of RC namespace in rc-slash-topic
MarcosSpessatto Feb 5, 2019
8687f9e
Remove dependency of RC namespace in rc-slash-unarchiveroom
MarcosSpessatto Feb 5, 2019
90adc29
Remove dependency of RC namespace in rc-smarsh-connector
MarcosSpessatto Feb 5, 2019
76a7209
Remove dependency of RC namespace in rc-sms
MarcosSpessatto Feb 5, 2019
73c2704
Remove dependency of RC namespace in rc-spotify
MarcosSpessatto Feb 5, 2019
56d9d99
Remove dependency of RC namespace in rc-statistics
MarcosSpessatto Feb 5, 2019
ad49a78
Move tokenpass models methods to rc-models
MarcosSpessatto Feb 5, 2019
8169e2c
Remove dependency of RC namespace in rc-tokenpass
MarcosSpessatto Feb 5, 2019
dfeab9f
import tokenpass inside rc-lib
MarcosSpessatto Feb 5, 2019
7e7752c
Remove dependency of RC namespace in rc-ui
MarcosSpessatto Feb 5, 2019
c9e2c01
Move webdavAccounts models to rc-model
MarcosSpessatto Feb 5, 2019
62e6542
Remove dependency of RC namespace in rc-ui-account
MarcosSpessatto Feb 5, 2019
2432e9a
Remove dependency of RC namespace in rc-ui-admin
MarcosSpessatto Feb 5, 2019
3c063a5
Remove dependency of RC namespace in rc-ui-clean-history
MarcosSpessatto Feb 5, 2019
18724d6
Remove dependency of RC namespace in rc-ui-flextab
MarcosSpessatto Feb 5, 2019
e877444
Remove dependency of RC namespace in rc-ui-login
MarcosSpessatto Feb 5, 2019
995f51a
Remove dependency of RC namespace in rc-ui-master
MarcosSpessatto Feb 5, 2019
060d85a
Remove dependency of RC namespace in rc-ui-message
MarcosSpessatto Feb 5, 2019
00b33ca
REmove dependency of RC namespace in rc-user-data-download
MarcosSpessatto Feb 5, 2019
ba43cc0
Remove dependency of RC namespace in rc-version-check
MarcosSpessatto Feb 5, 2019
ebe6d01
Remove dependency of RC namespace in rc-videobridge
MarcosSpessatto Feb 5, 2019
896070b
Remove dependency of RC namespace in rc-webdav
MarcosSpessatto Feb 5, 2019
112638c
Remove dependency of RC namespace in rc-wordpress
MarcosSpessatto Feb 5, 2019
79d7200
Remove some RC namespace use in chatpal-search
MarcosSpessatto Feb 5, 2019
869c40d
Remove dependency of RC namespace in rc-irc
MarcosSpessatto Feb 5, 2019
ce4f107
Remove dependency of RC namespace in livechat/client
MarcosSpessatto Feb 5, 2019
2e7cb78
Move methods in common livechat models to rc-models
MarcosSpessatto Feb 6, 2019
6a4f363
Remove dependency of RC namespace in rc-livechat/server/models
MarcosSpessatto Feb 6, 2019
2df8424
Remove LIvechat global variable from RC namespace
MarcosSpessatto Feb 6, 2019
42c8419
Remove dependency of RC namespace in rc-livechat/imports, lib, server…
MarcosSpessatto Feb 6, 2019
099527b
Remove dependency of RC namespace in rc-livechat/server/methods
MarcosSpessatto Feb 6, 2019
1f29533
Fix duplicated import
MarcosSpessatto Feb 6, 2019
0a5281d
Remove unused import
MarcosSpessatto Feb 6, 2019
2effa03
Remove dependency of RC namespace in rc-livechat/server/publications
MarcosSpessatto Feb 6, 2019
200fa23
MOve rc-livechat server models to rc-models
MarcosSpessatto Feb 6, 2019
bc5615a
Change imports of livechat server models to rc-models package
MarcosSpessatto Feb 6, 2019
767f35d
Remove dependency of RC namespace in rc-api/helpers and api.js (#13273)
MarcosSpessatto Feb 6, 2019
5228d2f
Remove dependency of RC namespace on half of api files (#13275)
MarcosSpessatto Feb 6, 2019
dbbdc8f
Remove dependency of RC namespace in rc-integrations
MarcosSpessatto Feb 6, 2019
f0d8a0c
Import missed functions in rc-irc
MarcosSpessatto Feb 6, 2019
b26f172
Remove dependency of RC namespace in rc-hipchat-enterprise-importer
MarcosSpessatto Feb 6, 2019
db160bf
Partial Remove dependency of RC namespace in rc-api (#13277)
MarcosSpessatto Feb 6, 2019
5643fd3
Remove dependency of RC namespace in root client folder
MarcosSpessatto Feb 6, 2019
7cfaa1e
Remove dependency of RC namespace in imports/message-read-receipt
MarcosSpessatto Feb 6, 2019
1eaaca7
Remove dependency of RC namespace in imports/personal-access-tokens
MarcosSpessatto Feb 6, 2019
c977598
Remove dependency of RC namespace in rc-api (#13278)
MarcosSpessatto Feb 6, 2019
599f6f3
Remove dependency of RC namespace in rc-graphql (#13279)
MarcosSpessatto Feb 6, 2019
e3fd332
Remove dependency of RC namespace in root server folder - step 1
MarcosSpessatto Feb 6, 2019
05bb4a6
Remove dependency of RC namespace in rc-importer (#13280)
MarcosSpessatto Feb 6, 2019
dc75e7d
Remove dependency of RC namespace in rc-ldap, katex and issue-links …
MarcosSpessatto Feb 6, 2019
412eb06
Remove dependency of RC namespace in rc-livestream and rc-mail-messa…
MarcosSpessatto Feb 6, 2019
3613dc5
Merge remote-tracking branch 'origin/depackaging' into globals/messag…
rodrigok Feb 13, 2019
da35a0b
Merge branch 'develop' into depackaging
MarcosSpessatto Feb 14, 2019
fbf2883
Merge remote-tracking branch 'origin/depackaging' into globals/messag…
rodrigok Feb 14, 2019
427692c
Merge remote-tracking branch 'origin/develop' into globals/message-pi…
rodrigok Feb 14, 2019
6150fd4
Merge remote-tracking branch 'origin/globals/message-pin-snippet' int…
rodrigok Feb 14, 2019
2ae5c47
Merge remote-tracking branch 'origin/develop' into globals/message-pi…
rodrigok Feb 14, 2019
32d2e62
Merge branch 'globals/message-pin-snippet' into globals/message-star-…
rodrigok Feb 14, 2019
61a7534
Merge branch 'globals/message-star-oauth2-server' into globals/oembed…
rodrigok Feb 14, 2019
4211b8e
Merge branch 'develop' into globals/message-star-oauth2-server
rodrigok Feb 14, 2019
ec940cb
Merge branch 'globals/message-star-oauth2-server' into globals/oembed…
rodrigok Feb 14, 2019
45f6a1e
Merge branch 'globals/oembed-otr' into globals/reactions-rp-search
rodrigok Feb 14, 2019
0495b53
Merge branch 'globals/reactions-rp-search' into globals/setup-slackbr…
rodrigok Feb 14, 2019
b5278f7
Merge branch 'globals/setup-slackbridge-asciiarts' into globals/slash
rodrigok Feb 14, 2019
fc6bcf8
Merge branch 'globals/slash' into globals/slash-wave-2
rodrigok Feb 14, 2019
2bd8afd
Merge remote-tracking branch 'origin/develop' into globals/reactions-…
rodrigok Feb 14, 2019
47a145d
Merge branch 'globals/reactions-rp-search' into globals/setup-slackbr…
rodrigok Feb 14, 2019
9f29f12
Merge branch 'globals/setup-slackbridge-asciiarts' into globals/slash
rodrigok Feb 14, 2019
4a23834
Merge branch 'globals/slash' into globals/slash-wave-2
rodrigok Feb 14, 2019
03e17cb
Merge branch 'develop' into globals/slash
rodrigok Feb 14, 2019
07b435b
Merge remote-tracking branch 'origin/globals/slash' into globals/slas…
rodrigok Feb 14, 2019
9f3d69c
Merge remote-tracking branch 'origin/develop' into globals/slash-wave-2
rodrigok Feb 14, 2019
867f05a
Merge branch 'globals/slash-wave-2' into globals/smarsh-sms-spotify
rodrigok Feb 14, 2019
2cea2ef
Merge branch 'globals/smarsh-sms-spotify' into globals/statistics-tok…
rodrigok Feb 14, 2019
4fe5462
Merge branch 'globals/statistics-tokenpass' into globals/ui-account-a…
rodrigok Feb 14, 2019
a348050
Merge branch 'develop' into globals/ui-account-admin
rodrigok Feb 14, 2019
7005d3c
Merge branch 'globals/ui-account-admin' into globals/ui-clean-history…
rodrigok Feb 14, 2019
dd9939b
Merge branch 'globals/ui-clean-history-flextab-login' into globals/ui…
rodrigok Feb 14, 2019
135f635
Merge branch 'globals/ui-master-message' into globals/videobridge
rodrigok Feb 14, 2019
8768bb0
Merge branch 'globals/videobridge' into globals/wordpress
rodrigok Feb 14, 2019
3d63bd8
Merge remote-tracking branch 'origin/develop' into globals/videobridge
rodrigok Feb 15, 2019
adc906c
Merge branch 'globals/videobridge' into globals/wordpress
rodrigok Feb 15, 2019
5af135e
Merge branch 'globals/wordpress' into globals/livechat-wave-1
rodrigok Feb 15, 2019
0c9eca5
Merge branch 'globals/livechat-wave-1' into globals/livechat-server-m…
rodrigok Feb 15, 2019
aa6f839
Merge branch 'globals/livechat-server-models' into globals/livechat-g…
rodrigok Feb 15, 2019
597e8e2
Merge remote-tracking branch 'origin/develop' into globals/livechat-s…
rodrigok Feb 15, 2019
db2928f
Merge branch 'globals/livechat-server-models' into globals/livechat-g…
rodrigok Feb 15, 2019
88d843c
Merge remote-tracking branch 'origin/develop' into globals/livechat-g…
rodrigok Feb 15, 2019
5e28cc9
Merge branch 'globals/livechat-global' into globals/livechat-server-r…
rodrigok Feb 15, 2019
1a4de21
Merge branch 'globals/livechat-server-rc-wave-1' into globals/livecha…
rodrigok Feb 15, 2019
8700c10
Merge branch 'globals/livechat-server-rc-wave-2' into globals/livecha…
rodrigok Feb 15, 2019
7c4d675
Merge remote-tracking branch 'origin/develop' into globals/livechat-s…
rodrigok Feb 15, 2019
5c258f4
Merge branch 'globals/livechat-server-rc-wave-1' into globals/livecha…
rodrigok Feb 15, 2019
e2925bf
Merge branch 'globals/livechat-server-rc-wave-2' into globals/livecha…
rodrigok Feb 15, 2019
2c424f9
Merge branch 'globals/livechat-server-rc-wave-3' into globals/livecha…
rodrigok Feb 15, 2019
d9c0f68
Merge branch 'globals/livechat-server-models-wave-4' into globals/int…
rodrigok Feb 15, 2019
62e3512
Merge branch 'globals/integrations' into globals/client-imports
rodrigok Feb 15, 2019
d3e1add
Merge remote-tracking branch 'origin/develop' into globals/livechat-s…
rodrigok Feb 15, 2019
e4538cd
Merge branch 'globals/livechat-server-models-wave-4' into globals/int…
rodrigok Feb 15, 2019
5ff6717
Merge branch 'globals/integrations' into globals/client-imports
rodrigok Feb 15, 2019
abf17ba
Merge branch 'globals/client-imports' into globals/server-wave-1
rodrigok Feb 15, 2019
8ce0f8a
Merge branch 'develop' into globals/client-imports
rodrigok Feb 15, 2019
1ca0ddf
Merge branch 'globals/client-imports' into globals/server-wave-1
rodrigok Feb 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions client/methods/deleteMessage.js
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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) {
Expand All @@ -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');
Expand Down
11 changes: 7 additions & 4 deletions client/methods/updateMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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) {
Expand Down
10 changes: 6 additions & 4 deletions client/notifications/UsersNameChanged.js
Original file line number Diff line number Diff line change
@@ -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: {
Expand All @@ -12,7 +14,7 @@ Meteor.startup(function() {
multi: true,
});

RocketChat.models.Messages.update({
Messages.update({
mentions: {
$elemMatch: { _id },
},
Expand All @@ -24,7 +26,7 @@ Meteor.startup(function() {
multi: true,
});

RocketChat.models.Subscriptions.update({
Subscriptions.update({
name: username,
t: 'd',
}, {
Expand Down
20 changes: 12 additions & 8 deletions client/notifications/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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())) {
Expand All @@ -33,15 +37,15 @@ 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,
fromOpenedRoom: messageIsInOpenedRoom,
hasFocus,
});

if (RocketChat.Layout.isEmbedded()) {
if (Layout.isEmbedded()) {
if (!hasFocus && messageIsInOpenedRoom) {
// Play a sound and show a notification.
KonchatNotification.newMessage(notification.payload.rid);
Expand All @@ -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);
Expand All @@ -83,7 +87,7 @@ Meteor.startup(function() {
}
};

RocketChat.Notifications.onUser('subscriptions-changed', (action, sub) => {
Notifications.onUser('subscriptions-changed', (action, sub) => {
notifyNewRoom(sub);
});
}
Expand Down
5 changes: 3 additions & 2 deletions client/notifications/updateAvatar.js
Original file line number Diff line number Diff line change
@@ -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);
});
});
5 changes: 3 additions & 2 deletions client/notifications/updateUserState.js
Original file line number Diff line number Diff line change
@@ -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);
});
});
3 changes: 2 additions & 1 deletion client/routes/roomRoute.js
Original file line number Diff line number Diff line change
@@ -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);
}
};
3 changes: 2 additions & 1 deletion client/routes/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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');
}
Expand Down
3 changes: 2 additions & 1 deletion client/startup/emailVerification.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 4 additions & 2 deletions client/startup/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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());
});
Expand Down
13 changes: 8 additions & 5 deletions client/startup/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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');
Expand All @@ -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,
Expand All @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions client/startup/unread.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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 = '•';
}
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion client/startup/userSetUtcOffset.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion imports/message-read-receipt/client/main.js
Original file line number Diff line number Diff line change
@@ -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';
}
},
Expand Down
3 changes: 2 additions & 1 deletion imports/message-read-receipt/client/message.js
Original file line number Diff line number Diff line change
@@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion imports/message-read-receipt/client/readReceipts.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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');
Expand Down
Loading