prevent users from being able to send more than one typed poll answer
This commit is contained in:
parent
db77e38104
commit
30f6a642dd
@ -18,6 +18,21 @@ export default function publishTypedVote(id, pollAnswer) {
|
||||
check(pollAnswer, String);
|
||||
check(id, String);
|
||||
|
||||
const allowedToVote = Polls.findOne({
|
||||
id,
|
||||
users: { $in: [requesterUserId] },
|
||||
meetingId,
|
||||
}, {
|
||||
fields: {
|
||||
users: 1,
|
||||
},
|
||||
});
|
||||
|
||||
if (!allowedToVote) {
|
||||
Logger.info(`Poll User={${requesterUserId}} has already voted in PollId={${id}}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
const activePoll = Polls.findOne({ meetingId, id }, {
|
||||
fields: {
|
||||
answers: 1,
|
||||
|
Loading…
Reference in New Issue
Block a user