Closed uplift closed 5 years ago
Look at you @uplift, getting all advanced with plugins firing hooks for other plugins to listen for :smile:
I have no objection to this if you want to open a PR for filter:sessionSharing.normalizePayload
, though for the errors, you can add this after if (err) {
:
if (plugins.hasListeners('filter:sessionSharing.error')) {
return plugins.fireHook('filter:sessionSharing.error', whatever, arguments, you, needed);
}
Haha, Trust me its better than the current approach I inherited :)
I'll try get something across in next couple of weeks as this is a background task for me currently.
Finally got round to looking at this. Have sent a pull request here - https://github.com/julianlam/nodebb-plugin-session-sharing/pull/59
Hi,
Would it be possible to fire a hook (passing in the payload and userData) in the normalizePayload function so we can do some custom normalizing of our app cookie data and custom validation on the payload?
https://github.com/julianlam/nodebb-plugin-session-sharing/blob/1a554696f40f130f5a824ed0d9bf1cb207875d60/library.js#L191
Also would it be possible to fire hooks after each error condition in the process callback for some custom error handling (passing in req, res, err, uid, plugin settings)?
https://github.com/julianlam/nodebb-plugin-session-sharing/blob/1a554696f40f130f5a824ed0d9bf1cb207875d60/library.js#L417 https://github.com/julianlam/nodebb-plugin-session-sharing/blob/1a554696f40f130f5a824ed0d9bf1cb207875d60/library.js#L421 https://github.com/julianlam/nodebb-plugin-session-sharing/blob/1a554696f40f130f5a824ed0d9bf1cb207875d60/library.js#L425 https://github.com/julianlam/nodebb-plugin-session-sharing/blob/1a554696f40f130f5a824ed0d9bf1cb207875d60/library.js#L429
Thanks