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 rc-slash-kick, leave, me, msg, mute, open, topic and unarchiveroom #13357

Merged
merged 120 commits into from
Feb 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 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
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
db160bf
Partial Remove dependency of RC namespace in rc-api (#13277)
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
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
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
4 changes: 4 additions & 0 deletions packages/rocketchat-models/server/models/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export class Messages extends Base {
return this.createWithTypeRoomIdMessageAndUser('room-archived', roomId, '', user);
}

createRoomUnarchivedByRoomIdAndUser(roomId, user) {
return this.createWithTypeRoomIdMessageAndUser('room-unarchived', roomId, '', user);
}

unsetReactions(messageId) {
return this.update({ _id: messageId }, { $unset: { reactions: 1 } });
}
Expand Down
4 changes: 2 additions & 2 deletions packages/rocketchat-slashcommands-kick/client/client.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RocketChat } from 'meteor/rocketchat:lib';
import { slashCommands } from 'meteor/rocketchat:utils';

RocketChat.slashCommands.add('kick', function(command, params) {
slashCommands.add('kick', function(command, params) {
const username = params.trim();
if (username === '') {
return;
Expand Down
4 changes: 3 additions & 1 deletion packages/rocketchat-slashcommands-kick/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ Package.onUse(function(api) {
api.use([
'ecmascript',
'check',
'rocketchat:lib',
'rocketchat:utils',
'rocketchat:notifications',
'rocketchat:models',
'templating',
]);
api.mainModule('client/index.js', 'client');
Expand Down
14 changes: 8 additions & 6 deletions packages/rocketchat-slashcommands-kick/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { Meteor } from 'meteor/meteor';
import { Match } from 'meteor/check';
import { Random } from 'meteor/random';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Notifications } from 'meteor/rocketchat:notifications';
import { Users, Subscriptions } from 'meteor/rocketchat:models';
import { slashCommands } from 'meteor/rocketchat:utils';

const Kick = function(command, params, { rid }) {
if (command !== 'kick' || !Match.test(params, String)) {
Expand All @@ -16,10 +18,10 @@ const Kick = function(command, params, { rid }) {
}
const userId = Meteor.userId();
const user = Meteor.users.findOne(userId);
const kickedUser = RocketChat.models.Users.findOneByUsername(username);
const kickedUser = Users.findOneByUsername(username);

if (kickedUser == null) {
return RocketChat.Notifications.notifyUser(userId, 'message', {
return Notifications.notifyUser(userId, 'message', {
_id: Random.id(),
rid,
ts: new Date,
Expand All @@ -30,9 +32,9 @@ const Kick = function(command, params, { rid }) {
});
}

const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(rid, user._id, { fields: { _id: 1 } });
const subscription = Subscriptions.findOneByRoomIdAndUserId(rid, user._id, { fields: { _id: 1 } });
if (!subscription) {
return RocketChat.Notifications.notifyUser(userId, 'message', {
return Notifications.notifyUser(userId, 'message', {
_id: Random.id(),
rid,
ts: new Date,
Expand All @@ -45,7 +47,7 @@ const Kick = function(command, params, { rid }) {
Meteor.call('removeUserFromRoom', { rid, username });
};

RocketChat.slashCommands.add('kick', Kick, {
slashCommands.add('kick', Kick, {
description: 'Remove_someone_from_room',
params: '@username',
permission: 'remove-user',
Expand Down
3 changes: 2 additions & 1 deletion packages/rocketchat-slashcommands-leave/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'ecmascript',
'rocketchat:lib',
'rocketchat:utils',
'rocketchat:notifications',
]);
api.mainModule('server/index.js', 'server');
});
9 changes: 5 additions & 4 deletions packages/rocketchat-slashcommands-leave/server/leave.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Notifications } from 'meteor/rocketchat:notifications';
import { slashCommands } from 'meteor/rocketchat:utils';

/*
* Leave is a named function that will replace /leave commands
Expand All @@ -15,7 +16,7 @@ function Leave(command, params, item) {
try {
Meteor.call('leaveRoom', item.rid);
} catch ({ error }) {
RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', {
Notifications.notifyUser(Meteor.userId(), 'message', {
_id: Random.id(),
rid: item.rid,
ts: new Date,
Expand All @@ -24,5 +25,5 @@ function Leave(command, params, item) {
}
}

RocketChat.slashCommands.add('leave', Leave, { description: 'Leave_the_current_channel' });
RocketChat.slashCommands.add('part', Leave, { description: 'Leave_the_current_channel' });
slashCommands.add('leave', Leave, { description: 'Leave_the_current_channel' });
slashCommands.add('part', Leave, { description: 'Leave_the_current_channel' });
2 changes: 1 addition & 1 deletion packages/rocketchat-slashcommands-me/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Package.describe({
Package.onUse(function(api) {
api.use([
'ecmascript',
'rocketchat:lib',
'rocketchat:utils',
]);
api.mainModule('server/index.js', 'server');
});
4 changes: 2 additions & 2 deletions packages/rocketchat-slashcommands-me/server/me.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { slashCommands } from 'meteor/rocketchat:utils';
import s from 'underscore.string';

/*
* Me is a named function that will replace /me commands
* @param {Object} message - The message object
*/
RocketChat.slashCommands.add('me', function Me(command, params, item) {
slashCommands.add('me', function Me(command, params, item) {
if (command !== 'me') {
return;
}
Expand Down
4 changes: 3 additions & 1 deletion packages/rocketchat-slashcommands-msg/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ Package.onUse(function(api) {
api.use([
'ecmascript',
'check',
'rocketchat:lib',
'rocketchat:utils',
'rocketchat:models',
'rocketchat:notifications',
'templating',
]);
api.mainModule('server/index.js', 'server');
Expand Down
12 changes: 7 additions & 5 deletions packages/rocketchat-slashcommands-msg/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { Meteor } from 'meteor/meteor';
import { Match } from 'meteor/check';
import { Random } from 'meteor/random';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { slashCommands } from 'meteor/rocketchat:utils';
import { Notifications } from 'meteor/rocketchat:notifications';
import { Users } from 'meteor/rocketchat:models';

/*
* Msg is a named function that will replace /msg commands
Expand All @@ -16,7 +18,7 @@ function Msg(command, params, item) {
const separator = trimmedParams.indexOf(' ');
const user = Meteor.users.findOne(Meteor.userId());
if (separator === -1) {
return RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', {
return Notifications.notifyUser(Meteor.userId(), 'message', {
_id: Random.id(),
rid: item.rid,
ts: new Date,
Expand All @@ -26,9 +28,9 @@ function Msg(command, params, item) {
const message = trimmedParams.slice(separator + 1);
const targetUsernameOrig = trimmedParams.slice(0, separator);
const targetUsername = targetUsernameOrig.replace('@', '');
const targetUser = RocketChat.models.Users.findOneByUsername(targetUsername);
const targetUser = Users.findOneByUsername(targetUsername);
if (targetUser == null) {
RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', {
Notifications.notifyUser(Meteor.userId(), 'message', {
_id: Random.id(),
rid: item.rid,
ts: new Date,
Expand All @@ -48,7 +50,7 @@ function Msg(command, params, item) {
Meteor.call('sendMessage', msgObject);
}

RocketChat.slashCommands.add('msg', Msg, {
slashCommands.add('msg', Msg, {
description: 'Direct_message_someone',
params: '@username <message>',
});
4 changes: 3 additions & 1 deletion packages/rocketchat-slashcommands-mute/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ Package.onUse(function(api) {
api.use([
'ecmascript',
'check',
'rocketchat:lib',
'rocketchat:utils',
'rocketchat:notifications',
'rocketchat:models',
]);
api.mainModule('server/index.js', 'server');
});
14 changes: 8 additions & 6 deletions packages/rocketchat-slashcommands-mute/server/mute.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { Meteor } from 'meteor/meteor';
import { Match } from 'meteor/check';
import { Random } from 'meteor/random';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { slashCommands } from 'meteor/rocketchat:utils';
import { Users, Subscriptions } from 'meteor/rocketchat:models';
import { Notifications } from 'meteor/rocketchat:notifications';

/*
* Mute is a named function that will replace /mute commands
*/

RocketChat.slashCommands.add('mute', function Mute(command, params, item) {
slashCommands.add('mute', function Mute(command, params, item) {
if (command !== 'mute' || !Match.test(params, String)) {
return;
}
Expand All @@ -18,9 +20,9 @@ RocketChat.slashCommands.add('mute', function Mute(command, params, item) {
}
const userId = Meteor.userId();
const user = Meteor.users.findOne(userId);
const mutedUser = RocketChat.models.Users.findOneByUsername(username);
const mutedUser = Users.findOneByUsername(username);
if (mutedUser == null) {
RocketChat.Notifications.notifyUser(userId, 'message', {
Notifications.notifyUser(userId, 'message', {
_id: Random.id(),
rid: item.rid,
ts: new Date,
Expand All @@ -32,9 +34,9 @@ RocketChat.slashCommands.add('mute', function Mute(command, params, item) {
return;
}

const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(item.rid, mutedUser._id, { fields: { _id: 1 } });
const subscription = Subscriptions.findOneByRoomIdAndUserId(item.rid, mutedUser._id, { fields: { _id: 1 } });
if (!subscription) {
RocketChat.Notifications.notifyUser(userId, 'message', {
Notifications.notifyUser(userId, 'message', {
_id: Random.id(),
rid: item.rid,
ts: new Date,
Expand Down
14 changes: 8 additions & 6 deletions packages/rocketchat-slashcommands-mute/server/unmute.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { Meteor } from 'meteor/meteor';
import { Match } from 'meteor/check';
import { Random } from 'meteor/random';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { slashCommands } from 'meteor/rocketchat:utils';
import { Users, Subscriptions } from 'meteor/rocketchat:models';
import { Notifications } from 'meteor/rocketchat:notifications';

/*
* Unmute is a named function that will replace /unmute commands
*/

RocketChat.slashCommands.add('unmute', function Unmute(command, params, item) {
slashCommands.add('unmute', function Unmute(command, params, item) {

if (command !== 'unmute' || !Match.test(params, String)) {
return;
Expand All @@ -18,9 +20,9 @@ RocketChat.slashCommands.add('unmute', function Unmute(command, params, item) {
return;
}
const user = Meteor.users.findOne(Meteor.userId());
const unmutedUser = RocketChat.models.Users.findOneByUsername(username);
const unmutedUser = Users.findOneByUsername(username);
if (unmutedUser == null) {
return RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', {
return Notifications.notifyUser(Meteor.userId(), 'message', {
_id: Random.id(),
rid: item.rid,
ts: new Date,
Expand All @@ -31,9 +33,9 @@ RocketChat.slashCommands.add('unmute', function Unmute(command, params, item) {
});
}

const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(item.rid, unmutedUser._id, { fields: { _id: 1 } });
const subscription = Subscriptions.findOneByRoomIdAndUserId(item.rid, unmutedUser._id, { fields: { _id: 1 } });
if (!subscription) {
return RocketChat.Notifications.notifyUser(Meteor.userId(), 'message', {
return Notifications.notifyUser(Meteor.userId(), 'message', {
_id: Random.id(),
rid: item.rid,
ts: new Date,
Expand Down
12 changes: 6 additions & 6 deletions packages/rocketchat-slashcommands-open/client/client.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { Match } from 'meteor/check';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { RocketChat } from 'meteor/rocketchat:lib';
import { ChatSubscription } from 'meteor/rocketchat:ui';
import { slashCommands, roomTypes } from 'meteor/rocketchat:utils';
import { ChatSubscription, Subscriptions } from 'meteor/rocketchat:models';

function Open(command, params /* , item*/) {
const dict = {
Expand Down Expand Up @@ -31,7 +31,7 @@ function Open(command, params /* , item*/) {
const subscription = ChatSubscription.findOne(query);

if (subscription) {
RocketChat.roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams);
roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams);
}

if (type && type.indexOf('d') === -1) {
Expand All @@ -41,13 +41,13 @@ function Open(command, params /* , item*/) {
if (err) {
return;
}
const subscription = RocketChat.models.Subscriptions.findOne(query);
RocketChat.roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams);
const subscription = Subscriptions.findOne(query);
roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams);
});

}

RocketChat.slashCommands.add('open', Open, {
slashCommands.add('open', Open, {
description: 'Opens_a_channel_group_or_direct_message',
params: 'room_name',
clientOnly: true,
Expand Down
3 changes: 2 additions & 1 deletion packages/rocketchat-slashcommands-open/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Package.onUse(function(api) {
api.use([
'ecmascript',
'check',
'rocketchat:lib',
'rocketchat:utils',
'rocketchat:models',
'kadira:flow-router',
'templating',
]);
Expand Down
12 changes: 7 additions & 5 deletions packages/rocketchat-slashcommands-topic/lib/topic.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat, handleError } from 'meteor/rocketchat:lib';
import { ChatRoom } from 'meteor/rocketchat:ui';
import { handleError, slashCommands } from 'meteor/rocketchat:utils';
import { ChatRoom } from 'meteor/rocketchat:models';
import { callbacks } from 'meteor/rocketchat:callbacks';
import { hasPermission } from 'meteor/rocketchat:authorization';
/*
* Join is a named function that will replace /topic commands
* @param {Object} message - The message object
*/

function Topic(command, params, item) {
if (command === 'topic') {
if ((Meteor.isClient && RocketChat.authz.hasPermission('edit-room', item.rid)) || (Meteor.isServer && RocketChat.authz.hasPermission(Meteor.userId(), 'edit-room', item.rid))) {
if ((Meteor.isClient && hasPermission('edit-room', item.rid)) || (Meteor.isServer && hasPermission(Meteor.userId(), 'edit-room', item.rid))) {
Meteor.call('saveRoomSettings', item.rid, 'roomTopic', params, (err) => {
if (err) {
if (Meteor.isClient) {
Expand All @@ -19,14 +21,14 @@ function Topic(command, params, item) {
}

if (Meteor.isClient) {
RocketChat.callbacks.run('roomTopicChanged', ChatRoom.findOne(item.rid));
callbacks.run('roomTopicChanged', ChatRoom.findOne(item.rid));
}
});
}
}
}

RocketChat.slashCommands.add('topic', Topic, {
slashCommands.add('topic', Topic, {
description: 'Slash_Topic_Description',
params: 'Slash_Topic_Params',
});
4 changes: 3 additions & 1 deletion packages/rocketchat-slashcommands-topic/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Package.describe({

Package.onUse(function(api) {
api.use([
'rocketchat:lib',
'rocketchat:utils',
'rocketchat:models',
'rocketchat:callbacks',
'ecmascript',
'rocketchat:authorization',
]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RocketChat } from 'meteor/rocketchat:lib';
import { slashCommands } from 'meteor/rocketchat:utils';

RocketChat.slashCommands.add('unarchive', null, {
slashCommands.add('unarchive', null, {
description: 'Unarchive',
params: '#channel',
});
4 changes: 3 additions & 1 deletion packages/rocketchat-slashcommands-unarchiveroom/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ Package.onUse(function(api) {
api.use([
'ecmascript',
'check',
'rocketchat:lib',
'rocketchat:utils',
'rocketchat:models',
'rocketchat:notifications',
'templating',
]);
api.mainModule('client/index.js', 'client');
Expand Down
Loading