jsHint fixes

pull/2654/head
Rodrigo Nascimento 10 years ago
parent a5cb22bb00
commit fc1fd30276
  1. 210
      .jshintrc
  2. 4
      packages/rocketchat-api/package.js
  3. 8
      packages/rocketchat-assets/package.js
  4. 19
      packages/rocketchat-authorization/client/lib/models/Subscriptions.js
  5. 10
      packages/rocketchat-authorization/client/lib/models/Users.js
  6. 2
      packages/rocketchat-authorization/package.js
  7. 24
      packages/rocketchat-authorization/server/models/Base.js
  8. 17
      packages/rocketchat-authorization/server/models/Subscriptions.js
  9. 10
      packages/rocketchat-authorization/server/models/Users.js
  10. 4
      packages/rocketchat-authorization/server/publications/scopedRoles.js
  11. 4
      packages/rocketchat-autolinker/package.js
  12. 6
      packages/rocketchat-channel-settings-mail-messages/package.js
  13. 6
      packages/rocketchat-channel-settings/package.js
  14. 8
      packages/rocketchat-chatops/package.js
  15. 4
      packages/rocketchat-colors/package.js
  16. 4
      packages/rocketchat-cors/package.js
  17. 10
      packages/rocketchat-favico/favico.js
  18. 3
      packages/rocketchat-file-upload/client/lib/FileUploadAmazonS3.js
  19. 2
      packages/rocketchat-file-upload/client/lib/fileUploadHandler.js
  20. 4
      packages/rocketchat-file-upload/globalFileRestrictions.js
  21. 6
      packages/rocketchat-file-upload/lib/FileUploadBase.js
  22. 4
      packages/rocketchat-file/package.js
  23. 4
      packages/rocketchat-highlight/package.js
  24. 24
      packages/rocketchat-hubot/package.js
  25. 6
      packages/rocketchat-iframe-login/package.js
  26. 116
      packages/rocketchat-integrations/package.js
  27. 2
      packages/rocketchat-integrations/server/logger.js
  28. 2
      packages/rocketchat-irc/package.js
  29. 2
      packages/rocketchat-katex/package.js
  30. 14
      packages/rocketchat-ldap/client/loginHelper.js
  31. 16
      packages/rocketchat-ldap/server/ldap.js
  32. 24
      packages/rocketchat-ldap/server/loginHandler.js
  33. 6
      packages/rocketchat-ldap/server/sync.js
  34. 8
      packages/rocketchat-ldap/server/syncUsers.js
  35. 6
      packages/rocketchat-ldap/server/testConnection.js
  36. 2
      packages/rocketchat-lib/package.js
  37. 4
      packages/rocketchat-lib/server/functions/checkEmailAvailability.js
  38. 18
      packages/rocketchat-lib/server/functions/setEmail.js
  39. 6
      packages/rocketchat-lib/server/lib/debug.js
  40. 12
      packages/rocketchat-lib/server/lib/sendEmailOnMessage.js
  41. 4
      packages/rocketchat-lib/server/methods/clearRequirePasswordChange.js
  42. 10
      packages/rocketchat-lib/server/methods/deleteUserOwnAccount.js
  43. 12
      packages/rocketchat-lib/server/methods/sendMessage.coffee
  44. 18
      packages/rocketchat-lib/server/methods/setEmail.js
  45. 2
      packages/rocketchat-logger/ansispan.js
  46. 2
      packages/rocketchat-mailer/package.js
  47. 4
      packages/rocketchat-me/package.js
  48. 6
      packages/rocketchat-mentions-flextab/package.js
  49. 4
      packages/rocketchat-mentions/package.js
  50. 4
      packages/rocketchat-message-attachments/package.js
  51. 6
      packages/rocketchat-message-pin/package.js
  52. 6
      packages/rocketchat-message-star/package.js
  53. 4
      packages/rocketchat-migrations/package.js
  54. 4
      packages/rocketchat-oauth2-server-config/package.js
  55. 4
      packages/rocketchat-oembed/package.js
  56. 8
      packages/rocketchat-otr/client/views/otrFlexTab.js
  57. 6
      packages/rocketchat-otr/server/settings.js
  58. 2
      packages/rocketchat-push-notifications/client/tabBar.js
  59. 16
      packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.js
  60. 6
      packages/rocketchat-push-notifications/package.js
  61. 4
      packages/rocketchat-push-notifications/server/methods/saveNotificationSettings.js
  62. 2
      packages/rocketchat-sharedsecret/package.js
  63. 6
      packages/rocketchat-slashcommands-invite/package.js
  64. 6
      packages/rocketchat-slashcommands-join/package.js
  65. 6
      packages/rocketchat-slashcommands-kick/package.js
  66. 4
      packages/rocketchat-slashcommands-leave/package.js
  67. 6
      packages/rocketchat-slashcommands-msg/package.js
  68. 6
      packages/rocketchat-slashcommands-mute/package.js
  69. 4
      packages/rocketchat-spotify/package.js
  70. 6
      packages/rocketchat-statistics/package.js
  71. 6
      packages/rocketchat-theme/package.js
  72. 4
      packages/rocketchat-tutum/package.js
  73. 1
      packages/rocketchat-ui-account/rocketchat-ui-account-tests.js
  74. 4
      packages/rocketchat-ui-admin/admin/rooms/channelSettingsDefault.js
  75. 1
      packages/rocketchat-ui-admin/rocketchat-ui-admin-tests.js
  76. 2
      packages/rocketchat-ui-login/login/layout.js
  77. 6
      packages/rocketchat-ui-master/server/fastRender.js
  78. 2
      packages/rocketchat-ui-master/server/inject.js
  79. 4
      packages/rocketchat-ui/lib/parentTemplate.js
  80. 28
      packages/rocketchat-ui/lib/updateModeratorsAndOwners.js
  81. 10
      packages/rocketchat-version/package.js
  82. 5
      packages/rocketchat-webrtc/package.js
  83. 8
      packages/rocketchat-wordpress/package.js

@ -1,107 +1,115 @@
{
"maxerr" : 50, // {int} Maximum error before stopping
"maxerr" : 50, // {int} Maximum error before stopping
// Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : true, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
"eqeqeq" : true, // true: Require triple equals (===) for comparison
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
"freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
"immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
"indent" : 2, // {int} Number of spaces to use for indentation
"latedef" : false, // true: Require variables/functions to be defined before being used
"newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
"noarg" : false, // true: Prohibit use of `arguments.caller` and `arguments.callee`
"noempty" : true, // true: Prohibit use of empty blocks
"nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters.
"nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment)
"plusplus" : false, // true: Prohibit use of `++` & `--`
"quotmark" : "single", // Quotation mark consistency:
// false : do nothing (default)
// true : ensure whatever is used is consistent
// "single" : require single quotes
// "double" : require double quotes
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
"unused" : true, // true: Require all defined variables be used
"strict" : false, // true: Requires all functions run in ES5 Strict Mode
"maxparams" : false, // {int} Max number of formal params allowed per function
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
"maxstatements" : false, // {int} Max number statements per function
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
"maxlen" : false, // {int} Max number of characters per line
// Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : false, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
"eqeqeq" : true, // true: Require triple equals (===) for comparison
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
"freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
"immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
"indent" : 2, // {int} Number of spaces to use for indentation
"latedef" : false, // true: Require variables/functions to be defined before being used
"newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
"noarg" : false, // true: Prohibit use of `arguments.caller` and `arguments.callee`
"noempty" : true, // true: Prohibit use of empty blocks
"nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters.
"nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment)
"plusplus" : false, // true: Prohibit use of `++` & `--`
"quotmark" : "single", // Quotation mark consistency:
// false : do nothing (default)
// true : ensure whatever is used is consistent
// "single" : require single quotes
// "double" : require double quotes
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
"unused" : true, // true: Require all defined variables be used
"strict" : false, // true: Requires all functions run in ES5 Strict Mode
"maxparams" : false, // {int} Max number of formal params allowed per function
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
"maxstatements" : false, // {int} Max number statements per function
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
"maxlen" : false, // {int} Max number of characters per line
// Relaxing
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
"boss" : false, // true: Tolerate assignments where comparisons would be expected
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
"eqnull" : true, // true: Tolerate use of `== null`
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
"esnext" : true, // true: Allow ES.next (ES6) syntax (ex: `const`)
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
// (ex: `for each`, multiple try/catch, function expression…)
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
"funcscope" : false, // true: Tolerate defining variables inside control statements
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
"iterator" : false, // true: Tolerate using the `__iterator__` property
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
"laxcomma" : false, // true: Tolerate comma-first style coding
"loopfunc" : false, // true: Tolerate functions being defined in loops
"multistr" : false, // true: Tolerate multi-line strings
"noyield" : false, // true: Tolerate generator functions with no yield statement in them.
"notypeof" : false, // true: Tolerate invalid typeof operator values
"proto" : false, // true: Tolerate using the `__proto__` property
"scripturl" : false, // true: Tolerate script-targeted URLs
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
"validthis" : false, // true: Tolerate using this in a non-constructor function
// Relaxing
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
"boss" : false, // true: Tolerate assignments where comparisons would be expected
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
"eqnull" : true, // true: Tolerate use of `== null`
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
"esnext" : true, // true: Allow ES.next (ES6) syntax (ex: `const`)
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
// (ex: `for each`, multiple try/catch, function expression…)
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
"funcscope" : false, // true: Tolerate defining variables inside control statements
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
"iterator" : false, // true: Tolerate using the `__iterator__` property
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
"laxcomma" : false, // true: Tolerate comma-first style coding
"loopfunc" : false, // true: Tolerate functions being defined in loops
"multistr" : false, // true: Tolerate multi-line strings
"noyield" : false, // true: Tolerate generator functions with no yield statement in them.
"notypeof" : false, // true: Tolerate invalid typeof operator values
"proto" : false, // true: Tolerate using the `__proto__` property
"scripturl" : false, // true: Tolerate script-targeted URLs
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
"validthis" : false, // true: Tolerate using this in a non-constructor function
// Environments
"browser" : true, // Web Browser (window, document, etc)
"browserify" : false, // Browserify (node.js code in the browser)
"couch" : false, // CouchDB
"devel" : false, // Development/debugging (alert, confirm, etc)
"dojo" : false, // Dojo Toolkit
"jasmine" : false, // Jasmine
"jquery" : true, // jQuery
"mocha" : false, // Mocha
"mootools" : false, // MooTools
"node" : true, // Node.js
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
"prototypejs" : false, // Prototype and Scriptaculous
"qunit" : false, // QUnit
"rhino" : false, // Rhino
"shelljs" : false, // ShellJS
"worker" : false, // Web Workers
"wsh" : false, // Windows Scripting Host
"yui" : false, // Yahoo User Interface
// Environments
"browser" : true, // Web Browser (window, document, etc)
"browserify" : false, // Browserify (node.js code in the browser)
"couch" : false, // CouchDB
"devel" : false, // Development/debugging (alert, confirm, etc)
"dojo" : false, // Dojo Toolkit
"jasmine" : false, // Jasmine
"jquery" : true, // jQuery
"mocha" : false, // Mocha
"mootools" : false, // MooTools
"node" : true, // Node.js
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
"prototypejs" : false, // Prototype and Scriptaculous
"qunit" : false, // QUnit
"rhino" : false, // Rhino
"shelljs" : false, // ShellJS
"worker" : false, // Web Workers
"wsh" : false, // Windows Scripting Host
"yui" : false, // Yahoo User Interface
// Custom Globals
"globals" : {
"_" : true,
"Assets" : true,
"Blaze" : true,
"crypto" : true,
"EJSON" : true,
"FlowRouter" : true,
"Meteor" : true,
"Npm" : true,
"Package" : true,
"Promise" : true, // Avoid "redefinition of Promise" warning
"Random" : true,
"ReactiveVar" : true,
"RocketChat" : true,
"s" : true,
"Session" : true,
"swal" : true,
"t" : true,
"TAPi18n" : true,
"Template" : true,
"TimeSync" : true,
"toastr" : true,
"Tracker" : true
}
// Custom Globals
"globals" : {
"_" : true,
"Assets" : true,
"SHA256" : true,
"Accounts" : true,
"Blaze" : true,
"Email" : true,
"check" : true,
"crypto" : true,
"EJSON" : true,
"FlowRouter" : true,
"BlazeLayout" : true,
"Meteor" : true,
"Npm" : true,
"Package" : true,
"Promise" : true, // Avoid "redefinition of Promise" warning
"Random" : true,
"ReactiveVar" : true,
"RocketChat" : true,
"RocketChatFile" : true,
"RocketChatFileAvatarInstance" : true,
"s" : true,
"Session" : true,
"swal" : true,
"t" : true,
"TAPi18n" : true,
"Template" : true,
"TimeSync" : true,
"toastr" : true,
"Logger" : true,
"Tracker" : true
}
}

@ -18,7 +18,3 @@ Package.onUse(function(api) {
api.addFiles('server/api.coffee', 'server');
api.addFiles('server/routes.coffee', 'server');
});
Package.onTest(function(api) {
});

@ -20,10 +20,6 @@ Package.onUse(function(api) {
});
Npm.depends({
"image-size": "0.4.0",
"mime-types": "2.1.9"
});
Package.onTest(function(api) {
'image-size': '0.4.0',
'mime-types': '2.1.9'
});

@ -1,35 +1,36 @@
Meteor.subscribe('scopedRoles', 'Subscriptions');
if (_.isUndefined(RocketChat.models.Subscriptions)) {
RocketChat.models.Subscriptions = {}
RocketChat.models.Subscriptions = {};
}
RocketChat.models.Subscriptions.isUserInRole = function(userId, roleName, roomId) {
query = {
var query = {
rid: roomId,
roles: roleName
};
return !_.isUndefined(this.findOne(query));
}
};
RocketChat.models.Subscriptions.findUsersInRoles = function(roles, scope, options) {
roles = [].concat(roles);
var query = {
roles: { $in: roles }
}
};
if (scope) {
query.rid = scope;
}
subscriptions = this.find(query).fetch();
var subscriptions = this.find(query).fetch();
users = _.compact(_.map(subscriptions, function(subscription) {
if ('undefined' !== typeof subscription.u && 'undefined' !== typeof subscription.u._id)
return subscription.u._id
var users = _.compact(_.map(subscriptions, function(subscription) {
if ('undefined' !== typeof subscription.u && 'undefined' !== typeof subscription.u._id) {
return subscription.u._id;
}
}));
return RocketChat.models.Users.find({ _id: { $in: users } }, options);
}
};

@ -1,24 +1,24 @@
Meteor.subscribe('scopedRoles', 'Users');
if (_.isUndefined(RocketChat.models.Users)) {
RocketChat.models.Users = {}
RocketChat.models.Users = {};
}
RocketChat.models.Users.isUserInRole = function(userId, roleName) {
query = {
var query = {
_id: userId,
roles: roleName
};
return !_.isUndefined(this.findOne(query));
}
};
RocketChat.models.Users.findUsersInRoles = function(roles, scope, options) {
roles = [].concat(roles);
var query = {
roles: { $in: roles }
}
};
return this.find(query, options);
}
};

@ -73,7 +73,7 @@ Package.onUse(function(api) {
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-authorization/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-authorization/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-authorization/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}

@ -1,38 +1,40 @@
RocketChat.models._Base.prototype.roleBaseQuery = function(userId, scope) { return {} }
RocketChat.models._Base.prototype.roleBaseQuery = function(/*userId, scope*/) {
return {};
};
RocketChat.models._Base.prototype.findRolesByUserId = function(userId, options) {
RocketChat.models._Base.prototype.findRolesByUserId = function(userId/*, options*/) {
var query = this.roleBaseQuery(userId);
return this.find(query, { fields: { roles: 1 } });
}
};
RocketChat.models._Base.prototype.isUserInRole = function(userId, roleName, scope) {
var query = this.roleBaseQuery(userId, scope);
query.roles = roleName;
return !_.isUndefined(this.findOne(query));
}
};
RocketChat.models._Base.prototype.addRolesByUserId = function(userId, roles, scope) {
var roles = [].concat(roles);
roles = [].concat(roles);
var query = this.roleBaseQuery(userId, scope);
var update = {
$addToSet: {
roles: { $each: roles }
}
}
};
return this.update(query, update);
}
};
RocketChat.models._Base.prototype.removeRolesByUserId = function(userId, roles, scope) {
var roles = [].concat(roles);
roles = [].concat(roles);
var query = this.roleBaseQuery(userId, scope);
var update = {
$pullAll: {
roles: roles
}
}
};
return this.update(query, update);
}
};
RocketChat.models._Base.prototype.findUsersInRoles = function() {
throw new Meteor.Error('overwrite-function', 'You must overwrite this function in the extended classes');
}
};

@ -1,28 +1,29 @@
RocketChat.models.Subscriptions.roleBaseQuery = function(userId, scope) {
var query = { "u._id": userId }
var query = { 'u._id': userId };
if (!_.isUndefined(scope)) {
query.rid = scope;
}
return query;
}
};
RocketChat.models.Subscriptions.findUsersInRoles = function(roles, scope, options) {
roles = [].concat(roles);
var query = {
roles: { $in: roles }
}
};
if (scope) {
query.rid = scope;
}
subscriptions = this.find(query).fetch();
var subscriptions = this.find(query).fetch();
users = _.compact(_.map(subscriptions, function(subscription) {
if ('undefined' !== typeof subscription.u && 'undefined' !== typeof subscription.u._id)
return subscription.u._id
var users = _.compact(_.map(subscriptions, function(subscription) {
if ('undefined' !== typeof subscription.u && 'undefined' !== typeof subscription.u._id) {
return subscription.u._id;
}
}));
return RocketChat.models.Users.find({ _id: { $in: users } }, options);
}
};

@ -1,13 +1,13 @@
RocketChat.models.Users.roleBaseQuery = function(userId, scope) {
return { _id: userId }
}
RocketChat.models.Users.roleBaseQuery = function(userId) {
return { _id: userId };
};
RocketChat.models.Users.findUsersInRoles = function(roles, scope, options) {
roles = [].concat(roles);
var query = {
roles: { $in: roles }
}
};
return this.find(query, options);
}
};

@ -3,8 +3,8 @@
*/
Meteor.publish('scopedRoles', function (scope) {
if (!this.userId || _.isUndefined(RocketChat.models[scope]) || !_.isFunction(RocketChat.models[scope].findRolesByUserId)) {
this.ready()
return
this.ready();
return;
}
return RocketChat.models[scope].findRolesByUserId(this.userId);

@ -16,7 +16,3 @@ Package.onUse(function(api) {
api.addFiles('autolinker.coffee', ['server','client']);
});
Package.onTest(function(api) {
});

@ -36,7 +36,7 @@ Package.onUse(function(api) {
// TAPi18n
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-channel-settings-mail-messages/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-channel-settings-mail-messages/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-channel-settings-mail-messages/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -44,7 +44,3 @@ Package.onUse(function(api) {
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -38,7 +38,7 @@ Package.onUse(function(api) {
// TAPi18n
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-channel-settings/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-channel-settings/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-channel-settings/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -46,7 +46,3 @@ Package.onUse(function(api) {
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -18,13 +18,13 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-chatops/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-chatops/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-chatops/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
}));
api.use('tap:i18n');
api.addFiles("package-tap.i18n", ["client", "server"]);
api.addFiles('package-tap.i18n', ['client', 'server']);
api.addFiles([
'client/startup.coffee',
@ -46,7 +46,3 @@ Package.onUse(function(api) {
// TAPi18n -- needs to be added last
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -16,7 +16,3 @@ Package.onUse(function(api) {
api.addFiles('client.coffee', 'client');
api.addFiles('style.css', 'client');
});
Package.onTest(function(api) {
});

@ -16,7 +16,3 @@ Package.onUse(function(api) {
api.addFiles('cors.coffee', 'server');
api.addFiles('common.coffee');
});
Package.onTest(function(api) {
});

@ -42,7 +42,7 @@
var _opt, _orig, _h, _w, _canvas, _context, _img, _ready, _lastBadge, _running, _readyCb, _stop, _browser, _animTimeout, _drawTimeout, _doc;
_browser = {};
_browser.ff = typeof InstallTrigger != 'undefined';
_browser.ff = typeof InstallTrigger !== 'undefined';
_browser.chrome = !!window.chrome;
_browser.opera = !!window.opera || navigator.userAgent.indexOf('Opera') >= 0;
_browser.ie = /*@cc_on!@*/ false;
@ -173,8 +173,6 @@
if (_queue.length > 0) {
_queue.shift();
icon.start();
} else {
}
};
if (_queue.length > 0) {
@ -210,7 +208,7 @@
opt.y = _h * opt.y;
opt.w = _w * opt.w;
opt.h = _h * opt.h;
opt.len = ("" + opt.n).length;
opt.len = ('' + opt.n).length;
return opt;
};
/**
@ -232,7 +230,7 @@
_context.clearRect(0, 0, _w, _h);
_context.drawImage(_img, 0, 0, _w, _h);
_context.beginPath();
_context.font = _opt.fontStyle + " " + Math.floor(opt.h * (opt.n > 99 ? 0.85 : 1)) + "px " + _opt.fontFamily;
_context.font = _opt.fontStyle + ' ' + Math.floor(opt.h * (opt.n > 99 ? 0.85 : 1)) + 'px ' + _opt.fontFamily;
_context.textAlign = 'center';
if (more) {
_context.moveTo(opt.x + opt.w / 2, opt.y);
@ -280,7 +278,7 @@
_context.clearRect(0, 0, _w, _h);
_context.drawImage(_img, 0, 0, _w, _h);
_context.beginPath();
_context.font = _opt.fontStyle + " " + Math.floor(opt.h * (opt.n > 99 ? 0.9 : 1)) + "px " + _opt.fontFamily;
_context.font = _opt.fontStyle + ' ' + Math.floor(opt.h * (opt.n > 99 ? 0.9 : 1)) + 'px ' + _opt.fontFamily;
_context.textAlign = 'center';
_context.fillStyle = 'rgba(' + _opt.bgColor.r + ',' + _opt.bgColor.g + ',' + _opt.bgColor.b + ',' + opt.o + ')';
_context.fillRect(opt.x, opt.y, opt.w, opt.h);

@ -1,4 +1,5 @@
/* globals FileUpload, FileUploadBase, Slingshot, Random */
/* globals FileUpload, FileUploadBase, Slingshot */
FileUpload.AmazonS3 = class FileUploadAmazonS3 extends FileUploadBase {
constructor(meta, file, data) {
super(meta, file, data);

@ -1,3 +1,5 @@
/* globals FileUpload, fileUploadHandler:true */
fileUploadHandler = (meta, file, data) => {
var storageType = RocketChat.settings.get('FileUpload_Storage_Type');

@ -1,5 +1,7 @@
/* globals Slingshot */
Slingshot.fileRestrictions('rocketchat-uploads', {
authorize: function(file, metaContext) {
authorize: function(file/*, metaContext*/) {
if (!RocketChat.fileUploadIsValidContentType(file.type)) {
throw new Meteor.Error(TAPi18n.__('Invalid_file_type'));
}

@ -1,5 +1,7 @@
/* globals FileUploadBase:true */
FileUploadBase = class FileUploadBase {
constructor(meta, file, data) {
constructor(meta, file/*, data*/) {
this.id = Random.id();
this.meta = meta;
this.file = file;
@ -20,4 +22,4 @@ FileUploadBase = class FileUploadBase {
stop() {
}
}
};

@ -22,7 +22,3 @@ Npm.depends({
'gridfs-stream': '0.5.3',
'gm': '1.18.1'
});
Package.onTest(function(api) {
});

@ -16,7 +16,3 @@ Package.onUse(function(api) {
api.addFiles('highlight.coffee', ['server','client']);
});
Package.onTest(function(api) {
});

@ -23,7 +23,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-hubot/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-hubot/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-hubot/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -40,16 +40,14 @@ Package.onUse(function(api) {
});
Npm.depends({
"coffee-script": "1.9.3",
"hubot": "2.13.1",
"hubot-calculator": "0.4.0",
"hubot-google-hangouts": "0.7.1",
"hubot-google-images": "0.1.5",
"hubot-google-translate": "0.2.0",
"hubot-maps": "0.0.2",
"hubot-help": "0.1.1",
"hubot-scripts": "2.16.1",
"hubot-youtube": "1.0.0",
'coffee-script': '1.9.3',
'hubot': '2.13.1',
'hubot-calculator': '0.4.0',
'hubot-google-hangouts': '0.7.1',
'hubot-google-images': '0.1.5',
'hubot-google-translate': '0.2.0',
'hubot-maps': '0.0.2',
'hubot-help': '0.1.1',
'hubot-scripts': '2.16.1',
'hubot-youtube': '1.0.0',
});
Package.onTest(function(api) {});

@ -1,7 +1,7 @@
Package.describe({
name: "rocketchat:iframe-login",
summary: "",
version: "1.0.0"
name: 'rocketchat:iframe-login',
summary: '',
version: '1.0.0'
});
Package.onUse(function(api) {

@ -1,77 +1,77 @@
Package.describe({
name: 'rocketchat:integrations',
version: '0.0.1',
summary: 'Integrations with services and WebHooks',
git: '',
documentation: 'README.md'
name: 'rocketchat:integrations',
version: '0.0.1',
summary: 'Integrations with services and WebHooks',
git: '',
documentation: 'README.md'
});
Package.onUse(function(api) {
api.versionsFrom('1.0');
api.versionsFrom('1.0');
api.use('coffeescript');
api.use('underscore');
api.use('ecmascript');
api.use('babel-compiler');
api.use('simple:highlight.js');
api.use('rocketchat:lib');
api.use('rocketchat:authorization');
api.use('rocketchat:api');
api.use('rocketchat:theme');
api.use('rocketchat:logger');
api.use('coffeescript');
api.use('underscore');
api.use('ecmascript');
api.use('babel-compiler');
api.use('simple:highlight.js');
api.use('rocketchat:lib');
api.use('rocketchat:authorization');
api.use('rocketchat:api');
api.use('rocketchat:theme');
api.use('rocketchat:logger');
api.use('kadira:flow-router', 'client');
api.use('templating', 'client');
api.use('kadira:flow-router', 'client');
api.use('templating', 'client');
api.addFiles('lib/rocketchat.coffee', ['server','client']);
api.addFiles('client/collection.coffee', ['client']);
api.addFiles('client/startup.coffee', 'client');
api.addFiles('client/route.coffee', 'client');
api.addFiles('lib/rocketchat.coffee', ['server','client']);
api.addFiles('client/collection.coffee', ['client']);
api.addFiles('client/startup.coffee', 'client');
api.addFiles('client/route.coffee', 'client');
// views
api.addFiles('client/views/integrations.html', 'client');
api.addFiles('client/views/integrations.coffee', 'client');
api.addFiles('client/views/integrationsNew.html', 'client');
api.addFiles('client/views/integrationsNew.coffee', 'client');
api.addFiles('client/views/integrationsIncoming.html', 'client');
api.addFiles('client/views/integrationsIncoming.coffee', 'client');
api.addFiles('client/views/integrationsOutgoing.html', 'client');
api.addFiles('client/views/integrationsOutgoing.coffee', 'client');
// views
api.addFiles('client/views/integrations.html', 'client');
api.addFiles('client/views/integrations.coffee', 'client');
api.addFiles('client/views/integrationsNew.html', 'client');
api.addFiles('client/views/integrationsNew.coffee', 'client');
api.addFiles('client/views/integrationsIncoming.html', 'client');
api.addFiles('client/views/integrationsIncoming.coffee', 'client');
api.addFiles('client/views/integrationsOutgoing.html', 'client');
api.addFiles('client/views/integrationsOutgoing.coffee', 'client');
// stylesheets
api.addAssets('client/stylesheets/integrations.less', 'server');
api.addFiles('client/stylesheets/load.coffee', 'server');
// stylesheets
api.addAssets('client/stylesheets/integrations.less', 'server');
api.addFiles('client/stylesheets/load.coffee', 'server');
api.addFiles('server/logger.js', 'server');
api.addFiles('server/logger.js', 'server');
api.addFiles('server/models/Integrations.coffee', 'server');
api.addFiles('server/models/Integrations.coffee', 'server');
// publications
api.addFiles('server/publications/integrations.coffee', 'server');
// publications
api.addFiles('server/publications/integrations.coffee', 'server');
// methods
api.addFiles('server/methods/incoming/addIncomingIntegration.coffee', 'server');
api.addFiles('server/methods/incoming/updateIncomingIntegration.coffee', 'server');
api.addFiles('server/methods/incoming/deleteIncomingIntegration.coffee', 'server');
api.addFiles('server/methods/outgoing/addOutgoingIntegration.coffee', 'server');
api.addFiles('server/methods/outgoing/updateOutgoingIntegration.coffee', 'server');
api.addFiles('server/methods/outgoing/deleteOutgoingIntegration.coffee', 'server');
// methods
api.addFiles('server/methods/incoming/addIncomingIntegration.coffee', 'server');
api.addFiles('server/methods/incoming/updateIncomingIntegration.coffee', 'server');
api.addFiles('server/methods/incoming/deleteIncomingIntegration.coffee', 'server');
api.addFiles('server/methods/outgoing/addOutgoingIntegration.coffee', 'server');
api.addFiles('server/methods/outgoing/updateOutgoingIntegration.coffee', 'server');
api.addFiles('server/methods/outgoing/deleteOutgoingIntegration.coffee', 'server');
// api
api.addFiles('server/api/api.coffee', 'server');
// api
api.addFiles('server/api/api.coffee', 'server');
api.addFiles('server/triggers.coffee', 'server');
api.addFiles('server/triggers.coffee', 'server');
api.addFiles('server/processWebhookMessage.js', 'server');
api.addFiles('server/processWebhookMessage.js', 'server');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-integrations/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-integrations/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
}));
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-integrations/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-integrations/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
}));
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});

@ -1,3 +1,5 @@
/* globals logger:true */
logger = new Logger('Integrations', {
sections: {
incoming: 'Incoming WebHook',

@ -22,5 +22,3 @@ Package.onUse(function(api) {
api.addFiles('irc.server.coffee', 'server');
api.export(['Irc'], ['server']);
});
Package.onTest(function(api) {});

@ -28,7 +28,7 @@ Package.onUse(function(api) {
api.addAssets(fontFiles, 'client');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-katex/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-katex/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-katex/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}

@ -14,10 +14,18 @@ Meteor.loginWithLDAP = function(username, password, customLdapOptions, callback)
// Check if last argument is a function
// if it is, pop it off and set callback to it
if (typeof args[args.length-1] == 'function') callback = args.pop(); else callback = null;
if (typeof args[args.length-1] === 'function') {
callback = args.pop();
} else {
callback = null;
}
// if args still holds options item, grab it
if (args.length > 0) customLdapOptions = args.shift(); else customLdapOptions = {};
if (args.length > 0) {
customLdapOptions = args.shift();
} else {
customLdapOptions = {};
}
// Set up loginRequest object
var loginRequest = {
@ -30,7 +38,7 @@ Meteor.loginWithLDAP = function(username, password, customLdapOptions, callback)
// Call login method with ldap = true
// This will hook into our login handler for ldap
methodArguments: [loginRequest],
userCallback: function(error, result) {
userCallback: function(error/*, result*/) {
if (error) {
if (callback) {
callback(error);

@ -1,3 +1,5 @@
/* globals LDAP:true, LDAPJS */
const ldapjs = LDAPJS;
const logger = new Logger('LDAP', {
@ -10,7 +12,7 @@ const logger = new Logger('LDAP', {
});
LDAP = class LDAP {
constructor(options) {
constructor() {
const self = this;
self.ldapjs = ldapjs;
@ -59,13 +61,13 @@ LDAP = class LDAP {
if (self.options.ca_cert && self.options.ca_cert !== '') {
// Split CA cert into array of strings
var chainLines = RocketChat.settings.get('LDAP_CA_Cert').split("\n");
var chainLines = RocketChat.settings.get('LDAP_CA_Cert').split('\n');
var cert = [];
var ca = [];
chainLines.forEach(function(line) {
cert.push(line);
if (line.match(/-END CERTIFICATE-/)) {
ca.push(cert.join("\n"));
ca.push(cert.join('\n'));
cert = [];
}
});
@ -173,7 +175,7 @@ LDAP = class LDAP {
filter.push(`(${self.options.domain_search_filter})`);
}
domain_search_user_id = self.options.domain_search_user_id.split(',');
const domain_search_user_id = self.options.domain_search_user_id.split(',');
if (domain_search_user_id.length === 1) {
filter.push(`(${domain_search_user_id[0]}=#{username})`);
} else {
@ -233,8 +235,6 @@ LDAP = class LDAP {
self.bindIfNecessary();
const domain_search = self.getDomainBindSearch();
let Unique_Identifier_Field = RocketChat.settings.get('LDAP_Unique_Identifier_Field').split(',');
let filter;
@ -301,7 +301,7 @@ LDAP = class LDAP {
}
if (result.length > 1) {
logger.search.error('Search by id', id, 'returned', result.length, 'records');
logger.search.error('Search by username', username, 'returned', result.length, 'records');
}
return result[0];
@ -331,7 +331,7 @@ LDAP = class LDAP {
jsonEntries.push(entry.json);
});
res.on('end', function(result) {
res.on('end', function(/*result*/) {
logger.search.info('Search result count', entries.length);
logger.search.debug('Search result', JSON.stringify(jsonEntries, null, 2));
callback(null, entries);

@ -1,19 +1,23 @@
/* globals LDAP, slug, getLdapUsername, getLdapUserUniqueID, syncUserData, getDataToSyncUserData */
const logger = new Logger('LDAPHandler', {});
function fallbackDefaultAccountSystem(bind, username, password) {
if (typeof username === 'string')
if (username.indexOf('@') === -1)
if (typeof username === 'string') {
if (username.indexOf('@') === -1) {
username = {username: username};
else
} else {
username = {email: username};
}
}
logger.info('Fallback to default account systen', username);
loginRequest = {
const loginRequest = {
user: username,
password: {
digest: SHA256(password),
algorithm: "sha-256"
algorithm: 'sha-256'
}
};
@ -21,7 +25,7 @@ function fallbackDefaultAccountSystem(bind, username, password) {
}
Accounts.registerLoginHandler("ldap", function(loginRequest) {
Accounts.registerLoginHandler('ldap', function(loginRequest) {
const self = this;
if (!loginRequest.ldapOptions) {
@ -39,7 +43,7 @@ Accounts.registerLoginHandler("ldap", function(loginRequest) {
try {
ldap.connectSync();
users = ldap.searchUsersSync(loginRequest.username);
const users = ldap.searchUsersSync(loginRequest.username);
if (users.length !== 1) {
logger.info('Search returned', users.length, 'record(s) for', loginRequest.username);
@ -100,13 +104,13 @@ Accounts.registerLoginHandler("ldap", function(loginRequest) {
if (user) {
if (user.ldap !== true) {
logger.info('User exists without "ldap: true"');
throw new Meteor.Error("LDAP-login-error", "LDAP Authentication succeded, but there's already an existing user with provided username ["+username+"] in Mongo.");
throw new Meteor.Error('LDAP-login-error', 'LDAP Authentication succeded, but there\'s already an existing user with provided username ['+username+'] in Mongo.');
}
logger.info('Logging user');
const stampedToken = Accounts._generateStampedLoginToken();
const hashStampedToken =
Meteor.users.update(user._id, {
$push: {
'services.resume.loginTokens': Accounts._hashStampedToken(stampedToken)
@ -136,7 +140,7 @@ Accounts.registerLoginHandler("ldap", function(loginRequest) {
} else if (RocketChat.settings.get('LDAP_Default_Domain') !== '') {
userObject.email = username + '@' + RocketChat.settings.get('LDAP_Default_Domain');
} else {
const error = new Meteor.Error("LDAP-login-error", "LDAP Authentication succeded, there is no email to create an account. Have you tried setting your Default Domain in LDAP Settings?");
const error = new Meteor.Error('LDAP-login-error', 'LDAP Authentication succeded, there is no email to create an account. Have you tried setting your Default Domain in LDAP Settings?');
logger.error(error);
throw error;
}

@ -1,3 +1,5 @@
/* globals slug:true, slugify, LDAP, getLdapUsername:true, getLdapUserUniqueID:true, getDataToSyncUserData:true, syncUserData:true, sync:true, */
const logger = new Logger('LDAPSync', {});
slug = function slug(text) {
@ -156,7 +158,7 @@ sync = function sync() {
try {
ldap.connectSync();
users = RocketChat.models.Users.findLDAPUsers();
const users = RocketChat.models.Users.findLDAPUsers();
users.forEach(function(user) {
let ldapUser;
@ -183,7 +185,7 @@ sync = function sync() {
};
let interval;
let timer;
let timeout;
RocketChat.settings.get('LDAP_Sync_User_Data', function(key, value) {
Meteor.clearInterval(interval);

@ -1,6 +1,8 @@
/* globals sync */
Meteor.methods({
ldap_sync_users: function() {
user = Meteor.user();
const user = Meteor.user();
if (!user) {
throw new Meteor.Error('unauthorized', '[methods] ldap_sync_users -> Unauthorized');
}
@ -13,11 +15,11 @@ Meteor.methods({
throw new Meteor.Error('LDAP_disabled');
}
result = sync();
const result = sync();
if (result === true) {
return {
message: "Sync_success",
message: 'Sync_success',
params: []
};
}

@ -1,6 +1,8 @@
/* globals LDAP */
Meteor.methods({
ldap_test_connection: function() {
user = Meteor.user();
const user = Meteor.user();
if (!user) {
throw new Meteor.Error('unauthorized', '[methods] ldap_test_connection -> Unauthorized');
}
@ -30,7 +32,7 @@ Meteor.methods({
}
return {
message: "Connection_success",
message: 'Connection_success',
params: []
};
}

@ -127,7 +127,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-lib/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-lib/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-lib/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}

@ -1,3 +1,3 @@
RocketChat.checkEmailAvailability = function(email) {
return !Meteor.users.findOne({ "emails.address": { $regex : new RegExp("^" + s.trim(s.escapeRegExp(email)) + "$", "i") } })
}
return !Meteor.users.findOne({ 'emails.address': { $regex : new RegExp('^' + s.trim(s.escapeRegExp(email)) + '$', 'i') } });
};

@ -1,19 +1,19 @@
RocketChat._setEmail = function(userId, email) {
email = s.trim(email)
email = s.trim(email);
if (!userId) {
throw new Meteor.Error('invalid-user', "[methods] setEmail -> Invalid user");
throw new Meteor.Error('invalid-user', '[methods] setEmail -> Invalid user');
}
if (!email) {
throw new Meteor.Error('invalid-email', "[methods] setEmail -> Invalid email");
throw new Meteor.Error('invalid-email', '[methods] setEmail -> Invalid email');
}
emailValidation = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
const emailValidation = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
if (!emailValidation.test(email)) {
throw new Meteor.Error('email-invalid', email + " is not a valid e-mail");
throw new Meteor.Error('email-invalid', email + ' is not a valid e-mail');
}
user = RocketChat.models.Users.findOneById(userId);
const user = RocketChat.models.Users.findOneById(userId);
// User already has desired username, return
if (user.emails && user.emails[0] && user.emails[0].address === email) {
@ -22,15 +22,15 @@ RocketChat._setEmail = function(userId, email) {
// Check e-mail availability
if (!RocketChat.checkEmailAvailability(email)) {
throw new Meteor.Error('email-unavailable', email + " is already in use :(");
throw new Meteor.Error('email-unavailable', email + ' is already in use :(');
}
// Set new email
RocketChat.models.Users.setEmail(user._id, email);
user.email = email;
return user;
}
};
RocketChat.setEmail = RocketChat.RateLimiter.limitFunction(RocketChat._setEmail, 1, 60000, {
0: function(userId) { return !RocketChat.authz.hasPermission(userId, 'edit-other-user-info') } // Administrators have permission to change others emails, so don't limit those
0: function(userId) { return !RocketChat.authz.hasPermission(userId, 'edit-other-user-info'); } // Administrators have permission to change others emails, so don't limit those
});

@ -1,7 +1,7 @@
RocketChat.debugLevel = 'debug';
Meteor.startup(function() {
RocketChat.settings.onload('Debug_Level', function(key, value, initialLoad) {
RocketChat.settings.onload('Debug_Level', function(key, value/*, initialLoad*/) {
if (value) {
RocketChat.debugLevel = value;
}
@ -16,7 +16,7 @@ Meteor.startup(function() {
var wrapMethods = function(name, originalHandler, methodsMap) {
methodsMap[name] = function() {
if (RocketChat.debugLevel === 'debug') {
var args = name === "ufsWrite" ? Array.prototype.slice.call(arguments, 1) : arguments;
var args = name === 'ufsWrite' ? Array.prototype.slice.call(arguments, 1) : arguments;
console.log('[methods]'.green, name, '-> userId:', Meteor.userId(), ', arguments: ', args);
}
@ -42,5 +42,5 @@ Meteor.publish = function(name, func) {
}
return func.apply(this, arguments);
})
});
};

@ -9,7 +9,7 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
if (room.t === 'd') {
usersToSendEmail[message.rid.replace(message.u._id, '')] = 1;
emailSubject = TAPi18n.__("Offline_DM_Email", {
emailSubject = TAPi18n.__('Offline_DM_Email', {
site: RocketChat.settings.get('Site_Name'),
user: message.u.username
});
@ -17,11 +17,11 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
} else {
if (message.mentions) {
message.mentions.forEach(function(mention) {
return usersToSendEmail[mention._id] = 1;
usersToSendEmail[mention._id] = 1;
});
}
emailSubject = TAPi18n.__("Offline_Mention_Email", {
emailSubject = TAPi18n.__('Offline_Mention_Email', {
site: RocketChat.settings.get('Site_Name'),
user: message.u.username,
room: room.name
@ -57,7 +57,7 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
}
});
userIdsToSendEmail = Object.keys(usersToSendEmail);
var userIdsToSendEmail = Object.keys(usersToSendEmail);
if (userIdsToSendEmail.length > 0) {
var usersOfMention = RocketChat.models.Users.getUsersToSendOfflineEmail(userIdsToSendEmail).fetch();
@ -69,11 +69,11 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
}
user.emails.some((email) => {
if (email.verified) {
var email = {
email = {
to: email.address,
from: RocketChat.settings.get('From_Email'),
subject: emailSubject,
html: "> " + message.html
html: '> ' + message.html
};
Email.send(email);

@ -1,9 +1,9 @@
Meteor.methods({
clearRequirePasswordChange: function() {
if (!Meteor.userId()) {
throw new Meteor.Error('invalid-user', "[methods] clearRequirePasswordChange -> Invalid user");
throw new Meteor.Error('invalid-user', '[methods] clearRequirePasswordChange -> Invalid user');
}
return RocketChat.models.Users.unsetRequirePasswordChange(Meteor.userId());
}
})
});

@ -1,19 +1,19 @@
Meteor.methods({
deleteUserOwnAccount: function(password) {
if (!Meteor.userId()) {
throw new Meteor.Error('invalid-user', "[methods] deleteUserOwnAccount -> Invalid user");
throw new Meteor.Error('invalid-user', '[methods] deleteUserOwnAccount -> Invalid user');
}
if (!RocketChat.settings.get('Accounts_AllowDeleteOwnAccount')) {
throw new Meteor.Error('not-authorized', "[methods] deleteUserOwnAccount -> Not authorized");
throw new Meteor.Error('not-authorized', '[methods] deleteUserOwnAccount -> Not authorized');
}
const userId = Meteor.userId();
const user = RocketChat.models.Users.findOneById(userId);
result = Accounts._checkPassword(user, { digest: password, algorithm: 'sha-256' });
const result = Accounts._checkPassword(user, { digest: password, algorithm: 'sha-256' });
if (result.error) {
throw new Meteor.Error('invalid-password', "[methods] deleteUserOwnAccount -> Invalid password");
throw new Meteor.Error('invalid-password', '[methods] deleteUserOwnAccount -> Invalid password');
}
Meteor.defer(function() {
@ -39,4 +39,4 @@ Meteor.methods({
return true;
}
})
});

@ -25,9 +25,9 @@ Meteor.methods
RocketChat.sendMessage user, message, room, options
# Limit a user to sending 5 msgs/second
DDPRateLimiter.addRule
type: 'method'
name: 'sendMessage'
userId: (userId) ->
return RocketChat.models.Users.findOneById(userId)?.username isnt RocketChat.settings.get('RocketBot_Name')
, 5, 1000
# DDPRateLimiter.addRule
# type: 'method'
# name: 'sendMessage'
# userId: (userId) ->
# return RocketChat.models.Users.findOneById(userId)?.username isnt RocketChat.settings.get('RocketBot_Name')
# , 5, 1000

@ -1,30 +1,30 @@
Meteor.methods({
setEmail: function(email) {
if (!Meteor.userId()) {
throw new Meteor.Error('invalid-user', "[methods] setEmail -> Invalid user");
throw new Meteor.Error('invalid-user', '[methods] setEmail -> Invalid user');
}
user = Meteor.user();
const user = Meteor.user();
if (!RocketChat.settings.get("Accounts_AllowEmailChange")) {
throw new Meteor.Error(403, "[methods] setEmail -> E-mail change not allowed");
if (!RocketChat.settings.get('Accounts_AllowEmailChange')) {
throw new Meteor.Error(403, '[methods] setEmail -> E-mail change not allowed');
}
if (user.emails && user.emails[0] && user.emails[0].address === email) {
return email;
}
emailValidation = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
const emailValidation = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
if (!emailValidation.test(email)) {
throw new Meteor.Error('email-invalid', email + " is not a valid e-mail");
throw new Meteor.Error('email-invalid', email + ' is not a valid e-mail');
}
if (!RocketChat.checkEmailAvailability(email)) {
throw new Meteor.Error('email-unavailable', email + " is already in use :(");
throw new Meteor.Error('email-unavailable', email + ' is already in use :(');
}
if (!RocketChat.setEmail(user._id, email)) {
throw new Meteor.Error('could-not-change-email', "Could not change email");
throw new Meteor.Error('could-not-change-email', 'Could not change email');
}
return email;
@ -32,5 +32,5 @@ Meteor.methods({
});
RocketChat.RateLimiter.limitMethod('setEmail', 1, 1000, {
userId: function(userId) { return true }
userId: function(/*userId*/) { return true; }
});

@ -1,3 +1,5 @@
/* globals ansispan:true */
ansispan = function (str) {
str = str.replace(/>/g, '>');
str = str.replace(/</g, '&lt;');

@ -39,7 +39,7 @@ Package.onUse(function(api) {
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
api.use('templating', 'client');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-mailer/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-mailer/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-mailer/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}

@ -15,7 +15,3 @@ Package.onUse(function(api) {
api.addFiles('me.coffee', ['server','client']);
});
Package.onTest(function(api) {
});

@ -32,7 +32,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-mentions-flextab/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-mentions-flextab/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-mentions-flextab/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -40,7 +40,3 @@ Package.onUse(function(api) {
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -16,7 +16,3 @@ Package.onUse(function(api) {
api.addFiles('server.coffee', 'server');
api.addFiles('client.coffee', 'client');
});
Package.onTest(function(api) {
});

@ -22,7 +22,3 @@ Package.onUse(function(api) {
api.addAssets('client/stylesheets/messageAttachments.less', 'server');
api.addFiles('client/stylesheets/loader.coffee', 'server');
});
Package.onTest(function(api) {
});

@ -36,7 +36,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-message-pin/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-message-pin/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-message-pin/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -44,7 +44,3 @@ Package.onUse(function(api) {
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -36,7 +36,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-message-star/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-message-star/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-message-star/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -44,7 +44,3 @@ Package.onUse(function(api) {
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -18,7 +18,3 @@ Package.onUse(function(api) {
api.addFiles('migrations.js', 'server');
});
Package.onTest(function(api) {
});

@ -1,7 +1,7 @@
Package.describe({
name: 'rocketchat:oauth2-server-config',
summary: "Configure the OAuth2 Server",
version: "1.0.0"
summary: 'Configure the OAuth2 Server',
version: '1.0.0'
});
Package.onUse(function(api) {

@ -40,7 +40,3 @@ Package.onUse(function(api) {
api.export('OEmbed', 'server');
});
Package.onTest(function(api) {
});

@ -34,7 +34,7 @@ Template.otrFlexTab.events({
if (otr) {
otr.handshake();
t.timeout = Meteor.setTimeout(() => {
swal("Timeout", "", "error");
swal('Timeout', '', 'error');
otr.establishing.set(false);
}, 10000);
}
@ -46,12 +46,12 @@ Template.otrFlexTab.events({
otr.reset();
otr.handshake(true);
t.timeout = Meteor.setTimeout(() => {
swal("Timeout", "", "error");
swal('Timeout', '', 'error');
otr.establishing.set(false);
}, 10000);
}
},
'click button.end': function(e, t) {
'click button.end': function(e/*, t*/) {
e.preventDefault();
const otr = RocketChat.OTR.getInstanceByRoomId(this.rid);
if (otr) {
@ -67,5 +67,5 @@ Template.otrFlexTab.onCreated(function() {
if (otr && otr.established.get()) {
Meteor.clearTimeout(this.timeout);
}
})
});
});

@ -1,3 +1,3 @@
RocketChat.settings.addGroup("OTR", function() {
this.add("OTR_Enable", true, { type: "boolean", public: true });
})
RocketChat.settings.addGroup('OTR', function() {
this.add('OTR_Enable', true, { type: 'boolean', public: true });
});

@ -6,5 +6,5 @@ Meteor.startup(function() {
icon: 'icon-bell-alt',
template: 'pushNotificationsFlexTab',
order: 2
})
});
});

@ -1,5 +1,7 @@
/* globals ChatSubscription */
Template.pushNotificationsFlexTab.helpers({
"desktopNotifications"() {
desktopNotifications() {
var sub = ChatSubscription.findOne({
rid: Session.get('openedRoom')
}, {
@ -9,7 +11,7 @@ Template.pushNotificationsFlexTab.helpers({
});
return sub ? sub.desktopNotifications : '';
},
"mobilePushNotifications"() {
mobilePushNotifications() {
var sub = ChatSubscription.findOne({
rid: Session.get('openedRoom')
}, {
@ -19,7 +21,7 @@ Template.pushNotificationsFlexTab.helpers({
});
return sub ? sub.mobilePushNotifications : '';
},
"emailNotifications"() {
emailNotifications() {
var sub = ChatSubscription.findOne({
rid: Session.get('openedRoom')
}, {
@ -29,7 +31,7 @@ Template.pushNotificationsFlexTab.helpers({
});
return sub ? sub.emailNotifications : '';
},
"showEmailMentions"() {
showEmailMentions() {
var sub = ChatSubscription.findOne({
rid: Session.get('openedRoom')
}, {
@ -39,7 +41,7 @@ Template.pushNotificationsFlexTab.helpers({
});
return sub && sub.t !== 'd';
},
"subValue"(field) {
subValue(field) {
var sub = ChatSubscription.findOne({
rid: Session.get('openedRoom')
}, {
@ -67,7 +69,7 @@ Template.pushNotificationsFlexTab.helpers({
}
}
},
"editing"(field) {
editing(field) {
return Template.instance().editing.get() === field;
}
});
@ -88,7 +90,7 @@ Template.pushNotificationsFlexTab.onCreated(function() {
const field = this.editing.get();
const value = this.$('input[name='+ field +']:checked').val();
if (this.validateSetting(field)) {
Meteor.call('saveNotificationSettings', Session.get('openedRoom'), field, value, (err, result) => {
Meteor.call('saveNotificationSettings', Session.get('openedRoom'), field, value, (err/*, result*/) => {
if (err) {
return toastr.error(t(err.reason || err.message));
}

@ -31,7 +31,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-push-notifications/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-push-notifications/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-push-notifications/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -39,7 +39,3 @@ Package.onUse(function(api) {
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -16,7 +16,7 @@ Meteor.methods({
throw new Meteor.Error('invalid-settings', 'Invalid settings value');
}
subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(rid, Meteor.userId());
const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(rid, Meteor.userId());
if (!subscription) {
throw new Meteor.Error('invalid-subscription', 'Invalid subscription');
}
@ -31,4 +31,4 @@ Meteor.methods({
return true;
}
})
});

@ -17,5 +17,3 @@ Package.onUse(function(api) {
api.addFiles('sharedsecret.coffee', ['server','client']);
});
Package.onTest(function(api) {});

@ -22,7 +22,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-slashcommands-invite/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-slashcommands-invite/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-slashcommands-invite/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -30,7 +30,3 @@ Package.onUse(function(api) {
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -22,7 +22,7 @@ Package.onUse(function(api) {
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) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-slashcommands-join/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-slashcommands-join/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -30,7 +30,3 @@ Package.onUse(function(api) {
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -22,7 +22,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-slashcommands-kick/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-slashcommands-kick/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-slashcommands-kick/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -30,7 +30,3 @@ Package.onUse(function(api) {
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -14,7 +14,3 @@ Package.onUse(function(api) {
]);
api.addFiles('leave.coffee');
});
Package.onTest(function(api) {
});

@ -22,7 +22,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-slashcommands-msg/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-slashcommands-msg/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-slashcommands-msg/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -30,7 +30,3 @@ Package.onUse(function(api) {
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -24,7 +24,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-slashcommands-mute/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-slashcommands-mute/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-slashcommands-mute/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -32,7 +32,3 @@ Package.onUse(function(api) {
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -21,7 +21,3 @@ Package.onUse(function(api) {
api.addFiles('lib/spotify.coffee', ['server','client']);
});
Package.onTest(function(api) {
});

@ -27,7 +27,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-statistics/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-statistics/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-statistics/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -36,7 +36,3 @@ Package.onUse(function(api) {
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

@ -40,7 +40,7 @@ Package.onUse(function(api) {
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
api.use('templating', 'client');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-theme/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-theme/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-theme/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -53,7 +53,3 @@ Npm.depends({
'less': 'https://github.com/meteor/less.js/tarball/8130849eb3d7f0ecf0ca8d0af7c4207b0442e3f6',
'less-plugin-autoprefix': '1.4.2'
});
Package.onTest(function(api) {
});

@ -15,7 +15,3 @@ Package.onUse(function(api) {
Npm.depends({
'redis': '2.2.5'
});
Package.onTest(function(api) {
});

@ -1,5 +1,6 @@
// Write your tests here!
// Here is an example.
/* globals Tinytest */
Tinytest.add('example', function (test) {
test.equal(true, true);
});

@ -1,3 +1,5 @@
/* globals ChatRoom */
Template.channelSettingsDefault.helpers({
canMakeDefault() {
var room = ChatRoom.findOne(this.rid, { fields: { t: 1 }});
@ -38,7 +40,7 @@ Template.channelSettingsDefault.events({
'click .save'(e, t) {
e.preventDefault();
Meteor.call('saveRoomSettings', this.rid, 'default', $('input[name=default]:checked').val(), (err, result) => {
Meteor.call('saveRoomSettings', this.rid, 'default', $('input[name=default]:checked').val(), (err/*, result*/) => {
if (err) {
if (err.error === 'invalid-room-type') {
return toastr.error(TAPi18n.__(err.reason, err.details.roomType));

@ -1,5 +1,6 @@
// Write your tests here!
// Here is an example.
/* globals Tinytest */
Tinytest.add('example', function (test) {
test.equal(true, true);
});

@ -1,3 +1,3 @@
Template.loginLayout.onRendered(function() {
$('.page-loading').remove();
})
});

@ -1,4 +1,6 @@
FastRender.onAllRoutes(function(path) {
/* globals FastRender */
FastRender.onAllRoutes(function(/*path*/) {
this.subscribe('settings');
this.subscribe("meteor.loginServiceConfiguration");
this.subscribe('meteor.loginServiceConfiguration');
});

@ -1,3 +1,5 @@
/* globals Inject */
Inject.rawBody('page-loading', `
<div class="page-loading">
<div class="spinner">

@ -6,11 +6,11 @@
Blaze.TemplateInstance.prototype.parentTemplate = function (levels) {
var view = Blaze.currentView;
if (typeof levels === "undefined") {
if (typeof levels === 'undefined') {
levels = 1;
}
while (view) {
if (view.name.substring(0, 9) === "Template." && !(levels--)) {
if (view.name.substring(0, 9) === 'Template.' && !(levels--)) {
return view.templateInstance();
}
view = view.parentView;

@ -1,15 +1,17 @@
/* globals RoomModeratorsAndOwners */
Meteor.startup(function() {
RocketChat.callbacks.add('streamMessage', function(msg) {
if (msg.t === 'new-moderator') {
user = Meteor.users.findOne({ username: msg.msg }, { fields: { username: 1 } });
RoomModeratorsAndOwners.upsert({ rid: msg.rid, "u._id": user._id }, { $setOnInsert: { u: user }, $addToSet: { roles: 'moderator' } });
const user = Meteor.users.findOne({ username: msg.msg }, { fields: { username: 1 } });
RoomModeratorsAndOwners.upsert({ rid: msg.rid, 'u._id': user._id }, { $setOnInsert: { u: user }, $addToSet: { roles: 'moderator' } });
} else if (msg.t === 'moderator-removed') {
user = Meteor.users.findOne({ username: msg.msg });
moderator = RoomModeratorsAndOwners.findOne({ rid: msg.rid, "u._id": user._id, roles: 'moderator' });
const user = Meteor.users.findOne({ username: msg.msg });
const moderator = RoomModeratorsAndOwners.findOne({ rid: msg.rid, 'u._id': user._id, roles: 'moderator' });
if (moderator && moderator.roles && moderator.roles.length === 1 && moderator.roles[0] === 'moderator') {
RoomModeratorsAndOwners.remove({ rid: msg.rid, "u._id": user._id, roles: 'moderator' });
RoomModeratorsAndOwners.remove({ rid: msg.rid, 'u._id': user._id, roles: 'moderator' });
} else if (moderator) {
RoomModeratorsAndOwners.update({ rid: msg.rid, "u._id": user._id }, { $pull: { roles: 'moderator' } });
RoomModeratorsAndOwners.update({ rid: msg.rid, 'u._id': user._id }, { $pull: { roles: 'moderator' } });
}
}
return msg;
@ -17,17 +19,17 @@ Meteor.startup(function() {
RocketChat.callbacks.add('streamMessage', function(msg) {
if (msg.t === 'new-owner') {
user = Meteor.users.findOne({ username: msg.msg }, { fields: { username: 1 } });
RoomModeratorsAndOwners.upsert({ rid: msg.rid, "u._id": user._id }, { $setOnInsert: { u: user }, $addToSet: { roles: 'owner' } });
const user = Meteor.users.findOne({ username: msg.msg }, { fields: { username: 1 } });
RoomModeratorsAndOwners.upsert({ rid: msg.rid, 'u._id': user._id }, { $setOnInsert: { u: user }, $addToSet: { roles: 'owner' } });
} else if (msg.t === 'owner-removed') {
user = Meteor.users.findOne({ username: msg.msg });
owner = RoomModeratorsAndOwners.findOne({ rid: msg.rid, "u._id": user._id, roles: 'owner' });
const user = Meteor.users.findOne({ username: msg.msg });
const owner = RoomModeratorsAndOwners.findOne({ rid: msg.rid, 'u._id': user._id, roles: 'owner' });
if (owner && owner.roles && owner.roles.length === 1 && owner.roles[0] === 'owner') {
RoomModeratorsAndOwners.remove({ rid: msg.rid, "u._id": user._id, roles: 'owner' });
RoomModeratorsAndOwners.remove({ rid: msg.rid, 'u._id': user._id, roles: 'owner' });
} else if (owner) {
RoomModeratorsAndOwners.update({ rid: msg.rid, "u._id": user._id }, { $pull: { roles: 'owner' } });
RoomModeratorsAndOwners.update({ rid: msg.rid, 'u._id': user._id }, { $pull: { roles: 'owner' } });
}
}
return msg;
}, RocketChat.callbacks.priority.LOW, 'addOrRemoveOwner');
})
});

@ -1,11 +1,11 @@
Package.describe({
name: 'rocketchat:version',
summary: "",
version: "1.0.0"
summary: '',
version: '1.0.0'
});
Package.registerBuildPlugin({
name: "compileVersion",
name: 'compileVersion',
use: ['coffeescript'],
sources: ['plugin/compile-version.coffee']
});
@ -13,7 +13,3 @@ Package.registerBuildPlugin({
Package.onUse(function (api) {
api.use('isobuild:compiler-plugin@1.0.0');
});
Package.onTest(function (api) {
});

@ -21,7 +21,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-webrtc/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-webrtc/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-webrtc/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -31,6 +31,3 @@ Package.onUse(function(api) {
api.export('WebRTC');
});
Package.onTest(function(api) {});

@ -9,7 +9,7 @@ Package.onUse(function(api) {
api.use('coffeescript');
api.use('rocketchat:lib');
api.use('rocketchat:custom-oauth');
api.addFiles("common.coffee");
api.addFiles('common.coffee');
api.addFiles('wordpress-login-button.css', 'client');
api.addFiles('startup.coffee', 'server');
@ -17,7 +17,7 @@ Package.onUse(function(api) {
api.use('templating', 'client');
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-wordpress/i18n'), function(filename) {
var tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-wordpress/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-wordpress/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
@ -25,7 +25,3 @@ Package.onUse(function(api) {
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});
Package.onTest(function(api) {
});

Loading…
Cancel
Save