New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nodebb-plugin-poll

Package Overview
Dependencies
Maintainers
5
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodebb-plugin-poll - npm Package Compare versions

Comparing version 3.1.4 to 3.1.5

1

lib/nodebb.js

@@ -11,2 +11,3 @@ 'use strict';

Privileges: require.main.require('./src/privileges'),
Plugins: require.main.require('./src/plugins'),
PluginSockets: require.main.require('./src/socket.io/plugins'),

@@ -13,0 +14,0 @@ AdminSockets: require.main.require('./src/socket.io/admin').plugins,

9

lib/poll.js

@@ -40,8 +40,8 @@ 'use strict';

async.apply(
async.parallel,
async.parallel,
pollData.options.map(
(option) => async.apply(NodeBB.db.setObject, `poll:${pollId}:options:${option.id}`, option)
option => async.apply(NodeBB.db.setObject, `poll:${pollId}:options:${option.id}`, option)
),
),
// Add poll option id to option list synchronously
// Add poll option id to option list synchronously
// To avoid race condition causing duplicate error

@@ -51,3 +51,3 @@ async.apply(

pollData.options.map(
(option) => async.apply(NodeBB.db.setAdd, `poll:${pollId}:options`, option.id)
option => async.apply(NodeBB.db.setAdd, `poll:${pollId}:options`, option.id)
),

@@ -61,3 +61,2 @@ ),

], (err) => {
if (err) {

@@ -64,0 +63,0 @@ return callback(err);

@@ -39,4 +39,3 @@ 'use strict';

pollData.optionType = parseInt(pollData.settings.maxvotes, 10) > 1 ? 'checkbox' : 'radio';
return callback(null, pollData);
callback(null, pollData);
});

@@ -192,18 +191,30 @@ };

}
Poll.getOption(data.pollId, data.optionId, true, (err, result) => {
async.parallel({
poll: function (next) {
Poll.getInfo(data.pollId, next);
},
option: function (next) {
Poll.getOption(data.pollId, data.optionId, true, next);
},
}, (err, result) => {
if (err) {
return callback(new Error('Something went wrong!'));
}
if (!result.votes || !result.votes.length) {
return callback(null, result);
const { poll, option } = result;
if (!option.votes || !option.votes.length) {
return callback(null, option);
}
NodeBB.User.getUsersFields(result.votes, ['uid', 'username', 'userslug', 'picture'], (err, userData) => {
NodeBB.User.getUsersFields(option.votes, ['uid', 'username', 'userslug', 'picture'], (err, userData) => {
if (err) {
console.error(err);
return callback(err);
}
result.votes = userData;
callback(null, result);
option.votes = userData;
NodeBB.Plugins.hooks.fire('filter:poll.getOptionDetails', {
poll,
option,
}, (err, result) => {
callback(err, result.option);
});
});

@@ -210,0 +221,0 @@ });

{
"name": "nodebb-plugin-poll",
"version": "3.1.4",
"version": "3.1.5",
"description": "NodeBB Poll Plugin",

@@ -5,0 +5,0 @@ "main": "library.js",

@@ -19,2 +19,10 @@ 'use strict';

$(window).on('action:posts.loaded', function (ev, data) {
data.posts.forEach((post) => {
if (post.hasOwnProperty('pollId')) {
getPoll(post.pollId);
}
});
});
$(window).on('action:posts.edited', function (ev, data) {

@@ -21,0 +29,0 @@ if (data.post.hasOwnProperty('pollId')) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc