diff --git a/applications/voting/vote.js b/applications/voting/vote.js index 5d64311..ade668e 100644 --- a/applications/voting/vote.js +++ b/applications/voting/vote.js @@ -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; diff --git a/applications/voting/vote.qml b/applications/voting/vote.qml index 09e2365..8e1159e 100644 --- a/applications/voting/vote.qml +++ b/applications/voting/vote.qml @@ -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++) {