FIX: refresh invite list after sending invite manually

This commit is contained in:
Arpit Jalan 2014-07-17 13:52:18 +05:30
parent 1713fd4b59
commit 2451779011
2 changed files with 11 additions and 2 deletions

View File

@ -8,6 +8,7 @@
@module Discourse
**/
export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
needs: ['user-invited'],
isAdmin: function(){
return Discourse.User.currentProp("admin");
@ -93,11 +94,18 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
if (this.get('disabled')) { return; }
var self = this;
var groupNames = this.get("groupNames");
var groupNames = this.get('groupNames');
var userInvitedController = this.get('controllers.user-invited');
this.setProperties({ saving: true, error: false });
this.get('model').createInvite(this.get('email'), groupNames).then(function() {
self.setProperties({ saving: false, finished: true });
if (!self.get('invitingToTopic')) {
Discourse.Invite.findInvitedBy(Discourse.User.current()).then(function (invite_model) {
userInvitedController.set('model', invite_model);
userInvitedController.set('totalInvites', invite_model.invites.length);
});
}
}).catch(function() {
self.setProperties({ saving: false, error: true });
});

View File

@ -8,11 +8,12 @@
**/
export default Ember.ObjectController.extend({
user: null,
model: null,
totalInvites: null,
init: function() {
this._super();
this.set('searchTerm', '');
this.set('totalInvites', '');
},
uploadText: function() { return I18n.t("user.invited.bulk_invite.text"); }.property(),