re organising files

pull/1449/head
Gabriel Engel 10 years ago
parent 6324e2bf04
commit 9682c27e68
  1. 2
      .meteor/versions
  2. 3
      packages/rocketchat-slashcommands-invite/client.coffee
  3. 5
      packages/rocketchat-slashcommands-invite/package.js
  4. 0
      packages/rocketchat-slashcommands-invite/server.coffee
  5. 3
      packages/rocketchat-slashcommands-join/client.coffee
  6. 36
      packages/rocketchat-slashcommands-join/join.coffee
  7. 13
      packages/rocketchat-slashcommands-join/package.js
  8. 31
      packages/rocketchat-slashcommands-join/server.coffee

@ -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

@ -0,0 +1,3 @@
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');

@ -0,0 +1,3 @@
RocketChat.slashCommands.add 'join', undefined,
description: TAPi18n.__ 'Join_the_given_channel'
params: '#channel'

@ -1,36 +0,0 @@
###
# 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,8 +6,6 @@ Package.describe({
});
Package.onUse(function(api) {
var client = 'client';
var both = ['client', 'server'];
api.versionsFrom('1.0');
@ -15,12 +13,13 @@ Package.onUse(function(api) {
'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) {

@ -0,0 +1,31 @@
###
# 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
Loading…
Cancel
Save