mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 21:40:39 +03:00
Adding helper for invite status
closes #3309, refs #3229 - adds different message depending on status - doesn't delete the new user if the problem was an email error - filters the 2 lists based on all statuses
This commit is contained in:
parent
9ad9e6e645
commit
d3491c53b9
@ -37,7 +37,12 @@ var InviteNewUserController = Ember.Controller.extend({
|
|||||||
|
|
||||||
self.notifications.showSuccess(notificationText, false);
|
self.notifications.showSuccess(notificationText, false);
|
||||||
}).catch(function (errors) {
|
}).catch(function (errors) {
|
||||||
newUser.deleteRecord();
|
if (errors[0].message.indexOf('Email Error:') === -1) {
|
||||||
|
newUser.deleteRecord();
|
||||||
|
} else {
|
||||||
|
newUser.set('status', 'invited-pending');
|
||||||
|
}
|
||||||
|
|
||||||
self.notifications.closePassive();
|
self.notifications.closePassive();
|
||||||
self.notifications.showErrors(errors);
|
self.notifications.showErrors(errors);
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
var UsersIndexController = Ember.ArrayController.extend({
|
var UsersIndexController = Ember.ArrayController.extend({
|
||||||
users: Ember.computed.alias('model'),
|
users: Ember.computed.alias('model'),
|
||||||
|
|
||||||
activeUsers: Ember.computed.filterBy('users', 'status', 'active'),
|
activeUsers: Ember.computed.filterBy('users', 'active', true).property('users'),
|
||||||
|
|
||||||
invitedUsers: Ember.computed.filterBy('users', 'status', 'invited')
|
invitedUsers: Ember.computed.filterBy('users', 'invited', true).property('users')
|
||||||
});
|
});
|
||||||
|
|
||||||
export default UsersIndexController;
|
export default UsersIndexController;
|
||||||
|
@ -63,6 +63,7 @@ var SettingsUserController = Ember.ObjectController.extend({
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.get('model').resendInvite().then(function () {
|
this.get('model').resendInvite().then(function () {
|
||||||
|
self.get('model').set('status', 'invited');
|
||||||
var notificationText = 'Invitation resent! (' + self.get('email') + ')';
|
var notificationText = 'Invitation resent! (' + self.get('email') + ')';
|
||||||
self.notifications.showSuccess(notificationText, false);
|
self.notifications.showSuccess(notificationText, false);
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
|
@ -64,8 +64,14 @@ var User = DS.Model.extend(NProgressSaveMixin, ValidationEngine, {
|
|||||||
return validationErrors;
|
return validationErrors;
|
||||||
}.property('password', 'newPassword', 'ne2Password'),
|
}.property('password', 'newPassword', 'ne2Password'),
|
||||||
|
|
||||||
isPasswordValid: Ember.computed.empty('passwordValidationErrors.[]')
|
isPasswordValid: Ember.computed.empty('passwordValidationErrors.[]'),
|
||||||
|
active: function () {
|
||||||
|
return _.contains(['active', 'warn-1', 'warn-2', 'warn-3', 'warn-4', 'locked'], this.get('status'));
|
||||||
|
}.property('status'),
|
||||||
|
invited: function () {
|
||||||
|
return _.contains(['invited', 'invited-pending'], this.get('status'));
|
||||||
|
}.property('status'),
|
||||||
|
pending: Ember.computed.equal('status', 'invited-pending').property('status')
|
||||||
});
|
});
|
||||||
|
|
||||||
export default User;
|
export default User;
|
||||||
|
@ -19,7 +19,11 @@
|
|||||||
|
|
||||||
<div class="object-list-item-body">
|
<div class="object-list-item-body">
|
||||||
<span class="name">{{email}}</span><br>
|
<span class="name">{{email}}</span><br>
|
||||||
<span class="description">Invitation sent: {{created_at}}</span>
|
{{#if pending}}
|
||||||
|
<span class="red">Invitation not sent - please try again</span>
|
||||||
|
{{else}}
|
||||||
|
<span class="description">Invitation sent: {{created_at}}</span>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<aside class="object-list-item-aside">
|
<aside class="object-list-item-aside">
|
||||||
<a class="object-list-action" href="#" {{action "revoke"}}>Revoke</a>
|
<a class="object-list-action" href="#" {{action "revoke"}}>Revoke</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user