From 4b2be8c6b3d46067e92a6d93019b88dea3c4e9b6 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Mon, 5 Feb 2024 10:27:23 +0100 Subject: [PATCH] FIX: Correctly save group invites (#25566) regressed in 19b86e7ea26b8c818e13040da0c68e6e312a804c --- .../discourse/app/components/modal/create-invite.js | 2 +- app/assets/javascripts/discourse/app/routes/group-index.js | 2 +- .../discourse/tests/acceptance/create-invite-modal-test.js | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) 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"); }); } );