Revert "Default Telegram polls to public"

This reverts commit c43e95e011.
This commit is contained in:
Nimrod Gutman
2026-02-17 09:38:15 +02:00
parent 60dc3741c0
commit b2fef5ebc4
8 changed files with 9 additions and 179 deletions

View File

@@ -1341,38 +1341,6 @@ describe("sendPollTelegram", () => {
expect(sendPollMock.mock.calls[0]?.[3]).toMatchObject({ open_period: 60 });
});
it("defaults polls to public (is_anonymous=false)", async () => {
const api = {
sendPoll: vi.fn(async () => ({ message_id: 123, chat: { id: 555 }, poll: { id: "p1" } })),
};
await sendPollTelegram(
"123",
{ question: "Q", options: ["A", "B"] },
{ token: "t", api: api as unknown as Bot["api"] },
);
expect(api.sendPoll).toHaveBeenCalledTimes(1);
const sendPollMock = api.sendPoll as ReturnType<typeof vi.fn>;
expect(sendPollMock.mock.calls[0]?.[3]).toMatchObject({ is_anonymous: false });
});
it("supports explicit anonymous polls", async () => {
const api = {
sendPoll: vi.fn(async () => ({ message_id: 123, chat: { id: 555 }, poll: { id: "p1" } })),
};
await sendPollTelegram(
"123",
{ question: "Q", options: ["A", "B"] },
{ token: "t", api: api as unknown as Bot["api"], isAnonymous: true },
);
expect(api.sendPoll).toHaveBeenCalledTimes(1);
const sendPollMock = api.sendPoll as ReturnType<typeof vi.fn>;
expect(sendPollMock.mock.calls[0]?.[3]).toMatchObject({ is_anonymous: true });
});
it("retries without message_thread_id on thread-not-found", async () => {
const api = {
sendPoll: vi.fn(