FIX: Auto-populate group field in invite modal on group route (#25431)

This commit is contained in:
Penar Musaraj 2024-01-26 17:02:48 +01:00 committed by GitHub
parent 76647d3a34
commit 19b86e7ea2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

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

View File

@ -255,6 +255,11 @@ acceptance(
automatic: false,
name: "Macdonald",
},
{
id: 47, // must match group-fixtures.js because lookup is by ID
automatic: false,
name: "Discourse",
},
]);
});
});
@ -271,5 +276,11 @@ acceptance(
assert.dom(".invite-to-groups .formatted-selection").hasText("Macdonald");
assert.dom("#invite-email").hasValue("cat.com");
});
test("shows correct saved data in group invite form", async function (assert) {
await visit("/g/discourse");
await click(".group-members-invite");
assert.dom(".invite-to-groups .formatted-selection").hasText("Discourse");
});
}
);