This commit is contained in:
Zhibo Zhang 2026-11-06 01:09:57 +00:00 • committed by GitHub
commit f7d1db2b03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -139,7 +139,13 @@ describe("key ownership", () => {
});
it("leaves the form's user_id alone for another_user", () => {
const expected = { key_alias: "my-key", user_id: "someone-else", duration: null, metadata: "{}" };
const expected = {
key_alias: "my-key",
user_id: "someone-else",
send_invite_email: true,
duration: null,
metadata: "{}",
};
expect(
payloadOf(build({ key_alias: "my-key", user_id: "someone-else" }, { keyOwner: "another_user" })),
).toStrictEqual(expected);

View file

@ -205,6 +205,7 @@ export const buildKeyCreatePayload = (input: KeyCreateInput): KeyPayloadResult =
...(values.organization_id === null && { organization_id: undefined }),
...(values.project_id === null && { project_id: undefined }),
...(input.keyOwner === "you" && { user_id: input.userID }),
...(input.keyOwner === "another_user" && { send_invite_email: true }),
...(input.keyOwner === "agent" && { agent_id: input.selectedAgentId }),
...(input.autoRotationEnabled && { auto_rotate: true, rotation_interval: input.rotationInterval }),
duration: !duration || (duration as string).trim() === "" ? null : duration,