Prompt before closing poll.

This commit is contained in:
armored-dragon 2024-09-10 15:08:25 -05:00
parent 8b4df95790
commit e117c13515
No known key found for this signature in database
GPG key ID: C7207ACC3382AD8B
2 changed files with 5 additions and 3 deletions

View file

@ -15,7 +15,6 @@
// TODO: Allow host voting
// TODO: Sound for new vote
// TODO: Clear poll host view on creating new poll
// TODO: Confirm before closing poll
// TODO: Debug mode?
// FIXME: Handle ties
// FIXME: Joining poll resets everyones vote
@ -139,13 +138,17 @@
// We are in a poll
if (poll.id == '') return;
var answer = Window.confirm('Are you sure you want to close the poll?')
if (!answer) return;
console.log("Closing active poll");
// Submit the termination message to all clients
Messages.sendMessage("ga-polls", JSON.stringify({type: "close_poll", poll: {id: poll.id}}));
// Update the UI screen
_emitEvent({type: "close_poll", poll: {id: poll.id}});
_emitEvent({type: "close_poll", poll: {id: poll.id}, change_page: true});
// Clear our active poll data
poll = { host: '', title: '', description: '', id: '', question: '', options: []};

View file

@ -266,7 +266,6 @@ Rectangle {
anchors.fill: parent
onClicked: {
toScript({type: "close_poll"});
current_page = "poll_list";
}
}
}