Skip to content
Snippets Groups Projects
Commit 9682c27e authored by Gabriel Engel's avatar Gabriel Engel
Browse files

re organising files

parent 6324e2bf
No related merge requests found
......@@ -25,7 +25,7 @@ cfs:http-methods@0.0.30
check@1.1.0
chrismbeckett:toastr@2.1.2_1
coffeescript@1.0.11
cosmos:browserify@0.9.1
cosmos:browserify@0.9.2
dandv:caret-position@2.1.1
ddp@1.2.2
ddp-client@1.2.1
......
RocketChat.slashCommands.add 'invite', undefined,
description: TAPi18n.__ 'Invite_user_to_join_channel'
params: '@username'
......@@ -6,16 +6,17 @@ Package.describe({
});
Package.onUse(function(api) {
api.versionsFrom('1.0');
api.use([
'coffeescript',
'check',
'tracker',
'rocketchat:lib@0.0.1'
]);
api.addFiles('invite.coffee');
api.addFiles('client.coffee', 'client');
api.addFiles('server.coffee', 'server');
// TAPi18n
api.use('templating', 'client');
......
RocketChat.slashCommands.add 'join', undefined,
description: TAPi18n.__ 'Join_the_given_channel'
params: '#channel'
###
# Join is a named function that will replace /join commands
# @param {Object} message - The message object
###
if Meteor.isClient
RocketChat.slashCommands.add 'join', undefined,
description: TAPi18n.__ 'Join_the_given_channel'
params: '#channel'
else
class Join
constructor: (command, params, item) ->
if command isnt 'join' or not Match.test params, String
return
channel = params.trim()
if channel is ''
return
channel = channel.replace('#', '')
user = Meteor.users.findOne Meteor.userId()
room = RocketChat.models.Rooms.findOneByNameAndTypeNotContainigUsername(channel, 'c', user.username)
if not room?
RocketChat.Notifications.notifyUser Meteor.userId(), 'message', {
_id: Random.id()
rid: item.rid
ts: new Date
msg: TAPi18n.__('Channel_doesnt_exist', { postProcess: 'sprintf', sprintf: [ channel ] }, user.language);
}
return
Meteor.call 'joinRoom', room._id
RocketChat.slashCommands.add 'join', Join
......@@ -6,21 +6,20 @@ Package.describe({
});
Package.onUse(function(api) {
var client = 'client';
var both = ['client', 'server'];
api.versionsFrom('1.0');
api.use([
'coffeescript',
'check',
'rocketchat:lib@0.0.1'
], both);
]);
api.addFiles('join.coffee', both);
api.addFiles('client.coffee', 'client');
api.addFiles('server.coffee', 'server');
// TAPi18n
api.use('templating', client);
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-slashcommands-join/i18n'), function(filename) {
......@@ -28,9 +27,9 @@ Package.onUse(function(api) {
return 'i18n/' + filename;
}
}));
api.use('tap:i18n@1.6.1', both);
api.use('tap:i18n@1.6.1', ['client', 'server']);
api.imply('tap:i18n');
api.addFiles(tapi18nFiles, both);
api.addFiles(tapi18nFiles, ['client', 'server']);
});
Package.onTest(function(api) {
......
###
# Join is a named function that will replace /join commands
# @param {Object} message - The message object
###
class Join
constructor: (command, params, item) ->
if command isnt 'join' or not Match.test params, String
return
channel = params.trim()
if channel is ''
return
channel = channel.replace('#', '')
user = Meteor.users.findOne Meteor.userId()
room = RocketChat.models.Rooms.findOneByNameAndTypeNotContainigUsername(channel, 'c', user.username)
if not room?
RocketChat.Notifications.notifyUser Meteor.userId(), 'message', {
_id: Random.id()
rid: item.rid
ts: new Date
msg: TAPi18n.__('Channel_doesnt_exist', { postProcess: 'sprintf', sprintf: [ channel ] }, user.language);
}
return
Meteor.call 'joinRoom', room._id
RocketChat.slashCommands.add 'join', Join
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