mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
refactored parse
This commit is contained in:
@@ -251,19 +251,19 @@ var winston = require('winston'),
|
|||||||
}
|
}
|
||||||
|
|
||||||
PostTools.parse = function(raw, callback) {
|
PostTools.parse = function(raw, callback) {
|
||||||
raw = raw || '';
|
parse('filter:post.parse', raw, callback);
|
||||||
|
|
||||||
plugins.fireHook('filter:post.parse', raw, function(err, parsed) {
|
|
||||||
callback(null, !err ? parsed : raw);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PostTools.parseSignature = function(raw, callback) {
|
PostTools.parseSignature = function(raw, callback) {
|
||||||
raw = raw || '';
|
parse('filter:post.parseSignature', raw, callback);
|
||||||
|
|
||||||
plugins.fireHook('filter:post.parseSignature', raw, function(err, parsedSignature) {
|
|
||||||
callback(null, !err ? parsedSignature : raw);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function parse(hook, raw, callback) {
|
||||||
|
raw = raw || '';
|
||||||
|
|
||||||
|
plugins.fireHook(hook, raw, function(err, parsed) {
|
||||||
|
callback(null, !err ? parsed : raw);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}(exports));
|
}(exports));
|
||||||
|
|||||||
Reference in New Issue
Block a user