Don't close all polls when you close yours.

This commit is contained in:
armored-dragon 2024-09-04 16:07:27 -05:00
parent a5883b1b2f
commit 2a7bfad711
No known key found for this signature in database
GPG key ID: C7207ACC3382AD8B
2 changed files with 6 additions and 3 deletions

View file

@ -14,6 +14,7 @@
// TODO: Documentation
// TODO: Save questions and answers locally
// TODO: Allow more than 9 candidates
// TODO: Allow host voting
(() => {
"use strict";
@ -247,11 +248,13 @@
// Polls closed :)
if (message.type == "close_poll") {
var isOurPoll = poll.id == message.poll.id;
// Tell UI to close poll
_emitEvent({type: "close_poll", poll: {id: message.poll.id}});
_emitEvent({type: "close_poll", change_page: isOurPoll, poll: {id: message.poll.id}});
// Unregister self from poll
leavePoll();
if (isOurPoll) leavePoll();
}
break;

View file

@ -627,7 +627,7 @@ Rectangle {
// Close the poll and remove it from the list of active polls
case "close_poll":
current_page = "poll_list"
if (message.isOurPoll) current_page = "poll_list"
// Find the poll with the matching ID and remove it from active polls
for (var i = 0; i < active_polls.count; i++) {