mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -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')) {
|
||||
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 });
|
||||
this.get('model.details.allowed_groups').pushObject(Ember.Object.create(data.group));
|
||||
this.appEvents.trigger('post-stream:refresh');
|
||||
|
||||
}).catch(onerror);
|
||||
|
||||
} else {
|
||||
|
@ -198,6 +201,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
});
|
||||
} else if (this.get('isMessage') && result && result.user) {
|
||||
this.get('model.details.allowed_users').pushObject(Ember.Object.create(result.user));
|
||||
this.appEvents.trigger('post-stream:refresh');
|
||||
}
|
||||
}).catch(onerror);
|
||||
}
|
||||
|
|
|
@ -396,8 +396,7 @@ class TopicsController < ApplicationController
|
|||
if topic.private_message?
|
||||
guardian.ensure_can_send_private_message!(group)
|
||||
topic.invite_group(current_user, group)
|
||||
|
||||
render json: success_json
|
||||
render_json_dump BasicGroupSerializer.new(group, scope: guardian, root: 'group')
|
||||
else
|
||||
render json: failed_json, status: 422
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue