Merge branch 'next' of github.com:coralproject/talk into next

* 'next' of github.com:coralproject/talk: (26 commits)
  removed snakecase
  fix to optional required param
  refactored mailer service with lodash!
  Docs typo
  Fix live status updates
  Move ChangeUsername to the appropiate tab
  Fix change username not displaying errors
  Remove defunct refetch detection workaround
  Rename UnBan and UnSuspend
  hardened configuration
  user cli patches
  don't apply configuration from dotfiles during testing
  applied rename to graph mutation edges
  reintroduced the errors.ErrSameUsernameProvided
  fixed wrong query logic
  resolving pr concerns
  Add proptype
  Mark onClickOutside not required
  Remove unused state
  Use null instead of boolean
  ...
This commit is contained in:
okbel
2018-01-09 10:13:07 -03:00
67 changed files with 805 additions and 861 deletions
@@ -5,7 +5,7 @@ const Context = require('../../../../graph/context');
const SettingsService = require('../../../../services/settings');
const UserModel = require('../../../../models/user');
const UsersService = require('../../../../services/users');
const MailerService = require('../../../../services/mailer');
const mailer = require('../../../../services/mailer');
const sinon = require('sinon');
const chai = require('chai');
@@ -22,7 +22,7 @@ describe('graph.mutations.banUser', () => {
let spy;
before(() => {
spy = sinon.spy(MailerService, 'sendSimple');
spy = sinon.spy(mailer, 'send');
});
afterEach(() => {
@@ -46,7 +46,7 @@ describe('graph.mutations.banUser', () => {
}
mutation UnBanUser($user_id: ID!) {
unBanUser(input: {
unbanUser(input: {
id: $user_id
}) {
errors {
@@ -112,7 +112,7 @@ describe('graph.mutations.banUser', () => {
console.error(res.errors);
}
expect(res.errors).to.be.undefined;
expect(res.data.unBanUser).to.be.null;
expect(res.data.unbanUser).to.be.null;
user = await UserModel.findOne({id: user.id});
@@ -6,7 +6,7 @@ const Context = require('../../../../graph/context');
const SettingsService = require('../../../../services/settings');
const UserModel = require('../../../../models/user');
const UsersService = require('../../../../services/users');
const MailerService = require('../../../../services/mailer');
const mailer = require('../../../../services/mailer');
const sinon = require('sinon');
const chai = require('chai');
@@ -24,7 +24,7 @@ describe('graph.mutations.suspendUser', () => {
let spy;
before(() => {
spy = sinon.spy(MailerService, 'sendSimple');
spy = sinon.spy(mailer, 'send');
});
afterEach(() => {
@@ -49,7 +49,7 @@ describe('graph.mutations.suspendUser', () => {
}
mutation UnSuspendUser($user_id: ID!) {
unSuspendUser(input: {
unsuspendUser(input: {
id: $user_id,
}) {
errors {
@@ -124,7 +124,7 @@ describe('graph.mutations.suspendUser', () => {
console.error(res.errors);
}
expect(res.errors).to.be.undefined;
expect(res.data.unSuspendUser).to.be.null;
expect(res.data.unsuspendUser).to.be.null;
user = await UserModel.findOne({id: user.id});
+1 -1
View File
@@ -54,7 +54,7 @@ describe('/api/v1/auth/local', () => {
.catch((err) => {
expect(err).to.not.be.null;
expect(err.response).to.have.status(401);
expect(err.response.body).to.have.property('message', 'not authorized');
expect(err.response.body).to.have.property('message', 'You are not authorized to perform this action.');
});
});
+4 -4
View File
@@ -1,6 +1,6 @@
const UsersService = require('../../../services/users');
const SettingsService = require('../../../services/settings');
const MailerService = require('../../../services/mailer');
const mailer = require('../../../services/mailer');
const chai = require('chai');
chai.use(require('chai-as-promised'));
@@ -29,11 +29,11 @@ describe('services.UsersService', () => {
password: '3Coral!3'
}]);
sinon.spy(MailerService, 'sendSimple');
sinon.spy(mailer, 'send');
});
afterEach(() => {
MailerService.sendSimple.restore();
mailer.send.restore();
});
describe('#findById()', () => {
@@ -238,7 +238,7 @@ describe('services.UsersService', () => {
await UsersService[func](user.id, user.username);
throw new Error('edit was processed successfully');
} catch (err) {
expect(err).have.property('translation_key', 'USERNAME_IN_USE');
expect(err).have.property('translation_key', 'SAME_USERNAME_PROVIDED');
}
} else {
await UsersService[func](user.id, user.username);