nodebb-plugin-poll 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/sockets.js +3 -3
- package/lib/vote.js +1 -1
- package/package.json +1 -1
package/lib/sockets.js
CHANGED
|
@@ -53,7 +53,7 @@ Sockets.vote = async function (socket, data) {
|
|
|
53
53
|
|
|
54
54
|
const [pollData, canVote, optionsFilter] = await Promise.all([
|
|
55
55
|
db.getObject(`poll:${data.pollId}`),
|
|
56
|
-
Vote.canVote(
|
|
56
|
+
Vote.canVote(socket.uid, data.pollId),
|
|
57
57
|
Poll.hasOptions(data.pollId, data.options),
|
|
58
58
|
]);
|
|
59
59
|
|
|
@@ -93,7 +93,7 @@ Sockets.updateVote = async function (socket, data) {
|
|
|
93
93
|
|
|
94
94
|
const [pollData, canUpdateVote, optionsFilter] = await Promise.all([
|
|
95
95
|
db.getObject(`poll:${data.pollId}`),
|
|
96
|
-
Vote.canUpdateVote(
|
|
96
|
+
Vote.canUpdateVote(socket.uid, data.pollId),
|
|
97
97
|
Poll.hasOptions(data.pollId, data.options),
|
|
98
98
|
]);
|
|
99
99
|
|
|
@@ -130,7 +130,7 @@ Sockets.removeVote = async function (socket, data) {
|
|
|
130
130
|
}
|
|
131
131
|
data.uid = socket.uid;
|
|
132
132
|
|
|
133
|
-
const canUpdateVote = await Vote.canUpdateVote(
|
|
133
|
+
const canUpdateVote = await Vote.canUpdateVote(socket.uid, data.pollId);
|
|
134
134
|
if (!canUpdateVote) {
|
|
135
135
|
throw new Error('Can\'t remove vote');
|
|
136
136
|
}
|
package/lib/vote.js
CHANGED
|
@@ -94,7 +94,7 @@ Vote.canVote = async function (uid, pollId) {
|
|
|
94
94
|
Poll.isDeleted(pollId),
|
|
95
95
|
Vote.hasUidVoted(uid, pollId),
|
|
96
96
|
]);
|
|
97
|
-
return
|
|
97
|
+
return canRead && !ended && !deleted && !hasVoted;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
Vote.hasUidVoted = async function (uid, pollId) {
|