Merge pull request #2553 from techAPJ/patch-1

FIX: refresh invite list after sending invite manually
This commit is contained in:
Robin Ward 2014-07-17 10:20:40 -04:00
commit a00cfbc6bf
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(),