poll_data: Revert to using "canned" instead of -1.

We revert to using "canned" instead of -1 when populating
`key_to_option` map so that it does not break for the old polls.
This commit is contained in:
Lalit 2023-07-19 20:48:24 +05:30 committed by Tim Abbott
parent 072a62d5b5
commit a871d7d90e
1 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ export type PollOptionData = {
type PollOption = { type PollOption = {
option: string; option: string;
user_id: number; user_id: number | string;
votes: Map<number, number>; votes: Map<number, number>;
}; };
@ -40,7 +40,7 @@ export type PollHandle = {
}; };
new_option: { new_option: {
outbound: (option: string) => {type: string; idx: number; option: string}; outbound: (option: string) => {type: string; idx: number; option: string};
inbound: (sender_id: number, data: InboundData) => void; inbound: (sender_id: number | string, data: InboundData) => void;
}; };
question: { question: {
outbound: (question: string) => {type: string; question: string} | undefined; outbound: (question: string) => {type: string; question: string} | undefined;
@ -238,7 +238,7 @@ export class PollData {
}; };
for (const [i, option] of options.entries()) { for (const [i, option] of options.entries()) {
this.handle.new_option.inbound(-1, { this.handle.new_option.inbound("canned", {
idx: i, idx: i,
option, option,
type: "new_option", type: "new_option",