Fix automated errors

pull/5833/head
Kiran Rao 9 years ago
parent 088fb78fe4
commit e8fcb500a6
  1. 2
      packages/rocketchat-lib/server/methods/joinRoom.js
  2. 2
      packages/rocketchat-lib/server/methods/setRealName.js
  3. 4
      packages/rocketchat-lib/server/methods/setUsername.js

@ -9,7 +9,7 @@ Meteor.methods({
const room = RocketChat.models.Rooms.findOneById(rid);
if (room == null) {
if (!room) {
throw new Meteor.Error('error-invalid-room', 'Invalid room', { method: 'joinRoom' });
}

@ -7,7 +7,7 @@ Meteor.methods({
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'setRealName' });
}
let user = Meteor.user();
const user = Meteor.user();
if (user.name === name) {
return name;

@ -9,7 +9,7 @@ Meteor.methods({
const user = Meteor.user();
if ((user.username != null) && !RocketChat.settings.get('Accounts_AllowUsernameChange')) {
if (user.username && !RocketChat.settings.get('Accounts_AllowUsernameChange')) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'setUsername' });
}
@ -42,7 +42,7 @@ Meteor.methods({
throw new Meteor.Error('error-could-not-change-username', 'Could not change username', { method: 'setUsername' });
}
if (user.username == null) {
if (!user.username) {
Meteor.runAsUser(user._id, () => Meteor.call('joinDefaultChannels', joinDefaultChannelsSilenced));
}

Loading…
Cancel
Save