FIX: Correctly save group invites (#25566)

regressed in 19b86e7ea2
This commit is contained in:
Jarek Radosz 2024-02-05 10:27:23 +01:00 committed by GitHub
parent 2c54eb253b
commit 4b2be8c6b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View File

@ -54,7 +54,7 @@ export default Component.extend(bufferedProperty("invite"), {
moment() moment()
.add(this.siteSettings.invite_expiry_days, "days") .add(this.siteSettings.invite_expiry_days, "days")
.format(FORMAT), .format(FORMAT),
groupIds: this.model.invite?.groupIds, groupIds: this.model.groupIds ?? this.model.invite?.groupIds,
topicId: this.model.invite?.topicId, topicId: this.model.invite?.topicId,
topicTitle: this.model.invite?.topicTitle, topicTitle: this.model.invite?.topicTitle,
}); });

View File

@ -36,7 +36,7 @@ export default DiscourseRoute.extend({
showInviteModal() { showInviteModal() {
const group = this.modelFor("group"); const group = this.modelFor("group");
this.modal.show(CreateInvite, { this.modal.show(CreateInvite, {
model: { invite: { groupIds: [group.id] } }, model: { groupIds: [group.id] },
}); });
}, },

View File

@ -262,6 +262,8 @@ acceptance(
}, },
]); ]);
}); });
server.post("/invites", () => helper.response({}));
}); });
test("shows correct saved data in form", async function (assert) { test("shows correct saved data in form", async function (assert) {
@ -281,6 +283,8 @@ acceptance(
await visit("/g/discourse"); await visit("/g/discourse");
await click(".group-members-invite"); await click(".group-members-invite");
assert.dom(".invite-to-groups .formatted-selection").hasText("Discourse"); assert.dom(".invite-to-groups .formatted-selection").hasText("Discourse");
await click(".save-invite");
}); });
} }
); );