mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
closes #2003
This commit is contained in:
16
src/posts.js
16
src/posts.js
@@ -336,6 +336,14 @@ var async = require('async'),
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stripTags(content) {
|
||||||
|
if (options.stripTags && content) {
|
||||||
|
var s = S(content);
|
||||||
|
return s.stripTags.apply(s, utils.stripTags).s;
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
@@ -361,6 +369,7 @@ var async = require('async'),
|
|||||||
post.relativeTime = utils.toISOString(post.timestamp);
|
post.relativeTime = utils.toISOString(post.timestamp);
|
||||||
|
|
||||||
if (!post.content || !options.parse) {
|
if (!post.content || !options.parse) {
|
||||||
|
post.content = stripTags(post.content);
|
||||||
return next(null, post);
|
return next(null, post);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,12 +378,7 @@ var async = require('async'),
|
|||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.stripTags && content) {
|
post.content = stripTags(content);
|
||||||
var s = S(content);
|
|
||||||
post.content = s.stripTags.apply(s, utils.stripTags).s;
|
|
||||||
} else {
|
|
||||||
post.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
next(null, post);
|
next(null, post);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user