Skip to content
Snippets Groups Projects
Commit 6b6d5eee authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Fix slach command /invite and enable package

parent fe81ae59
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ rocketchat:ldap
rocketchat:logger
rocketchat:markdown
rocketchat:me
#rocketchat:slashcommands-invite
rocketchat:slashcommands-invite
rocketchat:mentions
rocketchat:oembed
rocketchat:webrtc
......
......@@ -115,6 +115,7 @@ rocketchat:markdown@0.0.1
rocketchat:me@0.0.1
rocketchat:mentions@0.0.1
rocketchat:oembed@0.0.1
rocketchat:slashcommands-invite@0.0.1
rocketchat:statistics@0.0.1
rocketchat:webrtc@0.0.1
routepolicy@1.0.5
......
......@@ -5,15 +5,22 @@
class Invite
constructor: (command, params, item) ->
if(command == "invite")
if _.trim params
username = params.replace('@', '')
if command isnt 'invite' or not Match.test params, String
return
user = Meteor.users.findOne({ username: username })
username = params.trim()
if username is ''
return
if user?
Meteor.runAsUser user._id, ->
Meteor.call 'joinRoom', item.rid
username = username.replace('@', '')
user = Meteor.users.findOne({ username: username })
if not user?
return
Meteor.runAsUser user._id, ->
Meteor.call 'joinRoom', item.rid
RocketChat.slashCommands.add 'invite', Invite
......@@ -10,10 +10,11 @@ Package.onUse(function(api) {
api.use([
'coffeescript',
'check',
'rocketchat:lib@0.0.1'
]);
api.addFiles('invite.coffee', ['server','client']);
api.addFiles('invite.coffee', 'server');
});
Package.onTest(function(api) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment