Merge branch 'slashCommandForOpen' of https://github.com/Deepakkothandan/Rocket.Chat into Deepakkothandan-slashCommandForOpen
commit
063887f7de
@ -0,0 +1,25 @@ |
||||
function Open(command, params, item) { |
||||
var channel, room, subscription; |
||||
if (command !== 'open' || !Match.test(params, String)) { |
||||
return; |
||||
} |
||||
channel = params.trim(); |
||||
if (channel === '') { |
||||
room = RocketChat.models.Rooms.findOneById(item.rid); |
||||
channel = room.name; |
||||
} else { |
||||
channel = channel.replace('#', ''); |
||||
} |
||||
subscription = ChatSubscription.findOne({ |
||||
name: channel |
||||
}); |
||||
|
||||
if (subscription !== null) { |
||||
Meteor.call('openRoom', subscription.rid); |
||||
} |
||||
} |
||||
|
||||
RocketChat.slashCommands.add('open', Open, { |
||||
description: TAPi18n.__('Open_A_Channel'), |
||||
params: '#channel' |
||||
}); |
||||
@ -0,0 +1,21 @@ |
||||
Package.describe({ |
||||
name: 'rocketchat:slashcommands-open', |
||||
version: '0.0.1', |
||||
summary: 'Command handler for the /open command', |
||||
git: '' |
||||
}); |
||||
|
||||
Package.onUse(function(api) { |
||||
|
||||
api.versionsFrom('1.0'); |
||||
|
||||
api.use([ |
||||
'ecmascript', |
||||
'check', |
||||
'rocketchat:lib' |
||||
]); |
||||
|
||||
api.use('templating', 'client'); |
||||
|
||||
api.addFiles('client.js', 'client'); |
||||
}); |
||||
Loading…
Reference in new issue