This commit is contained in:
Calvin Montgomery 2021-10-13 20:12:31 -07:00
parent f41e0bda82
commit af62fbaef4
3 changed files with 57 additions and 8 deletions

View file

@ -97,7 +97,6 @@ PollModule.prototype.sendPoll = function (user) {
var perms = this.channel.modules.permissions;
user.socket.emit("closePoll");
if (perms.canViewHiddenPoll(user)) {
var unobscured = this.poll.toUpdateFrame(true);
user.socket.emit("newPoll", unobscured);
@ -116,9 +115,6 @@ PollModule.prototype.broadcastPoll = function (isNewPoll) {
var unobscured = this.poll.toUpdateFrame(true);
const event = isNewPoll ? "newPoll" : "updatePoll";
if (isNewPoll) {
this.channel.broadcastAll("closePoll");
}
this.channel.broadcastToRoom(event, unobscured, this.roomViewHidden);
this.channel.broadcastToRoom(event, obscured, this.roomNoViewHidden);
@ -152,6 +148,9 @@ PollModule.prototype.handleNewPoll = function (user, data, ack) {
return;
}
// Ensure any existing poll is closed
this.handleClosePoll(user);
ack = ackOrErrorMsg(ack, user);
if (typeof data !== 'object' || data === null) {
@ -252,6 +251,9 @@ PollModule.prototype.handlePollCmd = function (obscured, user, msg, _meta) {
return;
}
// Ensure any existing poll is closed
this.handleClosePoll(user);
msg = msg.replace(/^\/h?poll/, "");
var args = msg.split(",");