mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
FIX: update list of invited users after inviting
This commit is contained in:
parent
bb1fdd8134
commit
2d425892c4
2 changed files with 6 additions and 3 deletions
|
@ -183,8 +183,11 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.get('hasGroups')) {
|
if (this.get('hasGroups')) {
|
||||||
return this.get('model').createGroupInvite(this.get('emailOrUsername').trim()).then(() => {
|
return this.get('model').createGroupInvite(this.get('emailOrUsername').trim()).then((data) => {
|
||||||
model.setProperties({ saving: false, finished: true });
|
model.setProperties({ saving: false, finished: true });
|
||||||
|
this.get('model.details.allowed_groups').pushObject(Ember.Object.create(data.group));
|
||||||
|
this.appEvents.trigger('post-stream:refresh');
|
||||||
|
|
||||||
}).catch(onerror);
|
}).catch(onerror);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -198,6 +201,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
});
|
});
|
||||||
} else if (this.get('isMessage') && result && result.user) {
|
} else if (this.get('isMessage') && result && result.user) {
|
||||||
this.get('model.details.allowed_users').pushObject(Ember.Object.create(result.user));
|
this.get('model.details.allowed_users').pushObject(Ember.Object.create(result.user));
|
||||||
|
this.appEvents.trigger('post-stream:refresh');
|
||||||
}
|
}
|
||||||
}).catch(onerror);
|
}).catch(onerror);
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,8 +396,7 @@ class TopicsController < ApplicationController
|
||||||
if topic.private_message?
|
if topic.private_message?
|
||||||
guardian.ensure_can_send_private_message!(group)
|
guardian.ensure_can_send_private_message!(group)
|
||||||
topic.invite_group(current_user, group)
|
topic.invite_group(current_user, group)
|
||||||
|
render_json_dump BasicGroupSerializer.new(group, scope: guardian, root: 'group')
|
||||||
render json: success_json
|
|
||||||
else
|
else
|
||||||
render json: failed_json, status: 422
|
render json: failed_json, status: 422
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue