From a428bfc35bbbeb06d0a443b76b9b202958d4540f Mon Sep 17 00:00:00 2001 From: Austin Burdine Date: Sun, 9 Aug 2015 22:40:27 -0600 Subject: [PATCH] setup/three fixes refs #5315 - adds call to loadServerNotifications so that notifications are loaded after setup - fixes user invite so that you can't invite someone with the same email as you created the owner with --- core/client/app/controllers/setup/three.js | 17 +++++++++++++---- core/client/app/templates/setup/three.hbs | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/core/client/app/controllers/setup/three.js b/core/client/app/controllers/setup/three.js index 4c56a58d9683..bd0ed227fdec 100644 --- a/core/client/app/controllers/setup/three.js +++ b/core/client/app/controllers/setup/three.js @@ -3,8 +3,12 @@ import DS from 'ember-data'; export default Ember.Controller.extend({ notifications: Ember.inject.service(), + two: Ember.inject.controller('setup/two'), + errors: DS.Errors.create(), users: '', + + ownerEmail: Ember.computed.alias('two.email'), usersArray: Ember.computed('users', function () { var users = this.get('users').split('\n').filter(function (email) { return email.trim().length > 0; @@ -17,11 +21,12 @@ export default Ember.Controller.extend({ return validator.isEmail(user); }); }), - validateUsers: Ember.computed('usersArray', function () { - var errors = []; + validateUsers: Ember.computed('usersArray', 'ownerEmail', function () { + var errors = [], + self = this; this.get('usersArray').forEach(function (user) { - if (!validator.isEmail(user)) { + if (!validator.isEmail(user) || user === self.get('ownerEmail')) { errors.push({ user: user, error: 'email' @@ -115,6 +120,7 @@ export default Ember.Controller.extend({ invitationsString = successCount > 1 ? 'invitations' : 'invitation'; notifications.showAlert(successCount + ' ' + invitationsString + ' sent!', {type: 'success', delayed: true}); + self.send('loadServerNotifications'); self.transitionTo('posts.index'); } }); @@ -130,7 +136,10 @@ export default Ember.Controller.extend({ } }); } + }, + skipInvite: function () { + this.send('loadServerNotifications'); + this.transitionTo('posts.index'); } } }); - diff --git a/core/client/app/templates/setup/three.hbs b/core/client/app/templates/setup/three.hbs index ce9359d4dbcf..f67d5922d07a 100644 --- a/core/client/app/templates/setup/three.hbs +++ b/core/client/app/templates/setup/three.hbs @@ -14,6 +14,6 @@ -{{#link-to "posts" class="gh-flow-skip"}} +