diff --git a/app/assets/javascripts/discourse/app/components/modal/create-invite.js b/app/assets/javascripts/discourse/app/components/modal/create-invite.js index d521ddba976..399205f6025 100644 --- a/app/assets/javascripts/discourse/app/components/modal/create-invite.js +++ b/app/assets/javascripts/discourse/app/components/modal/create-invite.js @@ -54,7 +54,7 @@ export default Component.extend(bufferedProperty("invite"), { moment() .add(this.siteSettings.invite_expiry_days, "days") .format(FORMAT), - groupIds: this.model.invite?.groupIds, + groupIds: this.model.groupIds ?? this.model.invite?.groupIds, topicId: this.model.invite?.topicId, topicTitle: this.model.invite?.topicTitle, }); diff --git a/app/assets/javascripts/discourse/app/routes/group-index.js b/app/assets/javascripts/discourse/app/routes/group-index.js index 20c4fef33da..a83e9b79ad5 100644 --- a/app/assets/javascripts/discourse/app/routes/group-index.js +++ b/app/assets/javascripts/discourse/app/routes/group-index.js @@ -36,7 +36,7 @@ export default DiscourseRoute.extend({ showInviteModal() { const group = this.modelFor("group"); this.modal.show(CreateInvite, { - model: { invite: { groupIds: [group.id] } }, + model: { groupIds: [group.id] }, }); }, diff --git a/app/assets/javascripts/discourse/tests/acceptance/create-invite-modal-test.js b/app/assets/javascripts/discourse/tests/acceptance/create-invite-modal-test.js index 612e558027d..0e2f30dcf83 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/create-invite-modal-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/create-invite-modal-test.js @@ -262,6 +262,8 @@ acceptance( }, ]); }); + + server.post("/invites", () => helper.response({})); }); test("shows correct saved data in form", async function (assert) { @@ -281,6 +283,8 @@ acceptance( await visit("/g/discourse"); await click(".group-members-invite"); assert.dom(".invite-to-groups .formatted-selection").hasText("Discourse"); + + await click(".save-invite"); }); } );