Discord: handle thread edit params

This commit is contained in:
Shadow
2026-02-12 16:31:06 -06:00
parent abdceedaf6
commit 149db5b2c2
5 changed files with 65 additions and 0 deletions

View File

@@ -322,6 +322,11 @@ export async function handleDiscordGuildAction(
const rateLimitPerUser = readNumberParam(params, "rateLimitPerUser", {
integer: true,
});
const archived = typeof params.archived === "boolean" ? params.archived : undefined;
const locked = typeof params.locked === "boolean" ? params.locked : undefined;
const autoArchiveDuration = readNumberParam(params, "autoArchiveDuration", {
integer: true,
});
const channel = accountId
? await editChannelDiscord(
{
@@ -332,6 +337,9 @@ export async function handleDiscordGuildAction(
parentId,
nsfw,
rateLimitPerUser: rateLimitPerUser ?? undefined,
archived,
locked,
autoArchiveDuration: autoArchiveDuration ?? undefined,
},
{ accountId },
)
@@ -343,6 +351,9 @@ export async function handleDiscordGuildAction(
parentId,
nsfw,
rateLimitPerUser: rateLimitPerUser ?? undefined,
archived,
locked,
autoArchiveDuration: autoArchiveDuration ?? undefined,
});
return jsonResult({ ok: true, channel });
}

View File

@@ -315,6 +315,34 @@ describe("handleDiscordGuildAction - channel management", () => {
parentId: undefined,
nsfw: undefined,
rateLimitPerUser: undefined,
archived: undefined,
locked: undefined,
autoArchiveDuration: undefined,
});
});
it("forwards thread edit fields", async () => {
await handleDiscordGuildAction(
"channelEdit",
{
channelId: "C1",
archived: true,
locked: false,
autoArchiveDuration: 1440,
},
channelsEnabled,
);
expect(editChannelDiscord).toHaveBeenCalledWith({
channelId: "C1",
name: undefined,
topic: undefined,
position: undefined,
parentId: undefined,
nsfw: undefined,
rateLimitPerUser: undefined,
archived: true,
locked: false,
autoArchiveDuration: 1440,
});
});
@@ -335,6 +363,9 @@ describe("handleDiscordGuildAction - channel management", () => {
parentId: null,
nsfw: undefined,
rateLimitPerUser: undefined,
archived: undefined,
locked: undefined,
autoArchiveDuration: undefined,
});
});
@@ -355,6 +386,9 @@ describe("handleDiscordGuildAction - channel management", () => {
parentId: null,
nsfw: undefined,
rateLimitPerUser: undefined,
archived: undefined,
locked: undefined,
autoArchiveDuration: undefined,
});
});