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
1
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 0.2.12 to 0.2.13

31

lib/hooks.js

@@ -16,14 +16,7 @@ var NodeBB = require('./nodebb'),

Hooks.filter.postSave = function(postData, callback) {
if (Serializer.hasMarkup(postData.content)) {
// Is this the first post?
NodeBB.Topics.getPostCount(postData.tid, function(err, postCount) {
if (parseInt(postCount, 10) !== 0) {
return callback(null, postData);
}
savePoll(postData, callback);
});
Hooks.filter.postCreate = function(obj, callback) {
if (Serializer.hasMarkup(obj.post.content) && obj.data.isMain) {
savePoll(obj, callback);
} else {
return callback(null, postData);
return callback(null, obj);
}

@@ -113,18 +106,18 @@ };

function savePoll(postData, callback) {
var pollData = Serializer.serialize(postData.content, Config.settings.get());
function savePoll(obj, callback) {
var pollData = Serializer.serialize(obj.post.content, Config.settings.get());
if (!pollData || !pollData.options.length) {
return callback(null, postData);
return callback(null, obj);
}
Poll.add(pollData, postData, function(err, pollId) {
Poll.add(pollData, obj.post, function(err, pollId) {
if (err) {
return callback(err, postData);
return callback(err, obj);
}
postData.pollId = pollId;
postData.content = Serializer.removeMarkup(postData.content);
obj.post.pollId = pollId;
obj.post.content = Serializer.removeMarkup(obj.post.content);
callback(null, postData);
callback(null, obj);
});

@@ -131,0 +124,0 @@ }

{
"name": "nodebb-plugin-poll",
"version": "0.2.12",
"version": "0.2.13",
"description": "NodeBB Poll Plugin",

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

@@ -19,3 +19,3 @@ {

{ "hook": "filter:parse.raw", "method": "hooks.filter.parseRaw", "priority": 1 },
{ "hook": "filter:post.save", "method": "hooks.filter.postSave" },
{ "hook": "filter:post.create", "method": "hooks.filter.postCreate" },
{ "hook": "filter:post.edit", "method": "hooks.filter.postEdit" },

@@ -22,0 +22,0 @@

@@ -102,5 +102,4 @@ "use strict";

textarea.value += markup;
if ($.Redactor) textarea.redactor('<p>' + textarea.value + '</p>');
if ($.Redactor) textarea.redactor(textarea.value + '<p>' + markup + '</p>');
else textarea.value += markup
});

@@ -107,0 +106,0 @@ });

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