From 2d425892c492e06f54aaceaf04764c824b5effc2 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 21 Jun 2016 16:01:29 +1000 Subject: [PATCH] FIX: update list of invited users after inviting --- app/assets/javascripts/discourse/controllers/invite.js.es6 | 6 +++++- app/controllers/topics_controller.rb | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/invite.js.es6 b/app/assets/javascripts/discourse/controllers/invite.js.es6 index eac694a07a6..38bd223072a 100644 --- a/app/assets/javascripts/discourse/controllers/invite.js.es6 +++ b/app/assets/javascripts/discourse/controllers/invite.js.es6 @@ -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); } diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index 24f7626e3e2..90f883f9646 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -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