* Add post images hook
This hook would allow plugins to manipulate images inside posts after images are manipulated by nodebb (for example, delay loading). Without this hook we can manipulate images by searching post data for them and manipulate that data, but any change on that level is either erased by nodebb once image loading starts (if delay is turned on) or it disables native image behaviour by changing image code so native behaviour is not triggered.
Hook at this place works for both delayed loading turned on and off.
Usage for this kind of hook was talked about here: https://community.nodebb.org/topic/10960/opening-uploaded-images-in-modal-windows
* trying to fix Travis error
* Update images.js
Hook moved out of wrapImagesInLinks function to places where images are actually loaded. One of the places is inside unloadImage function but in place where loading is happening because of failed if check (delayImageLoading not se in users configuration).
* Adds the filter:uploadStored hook which fires after the file is saved in the async waterfall and passes:
var storedFile = {
url: nconf.get('relative_path') + upload.url,
path: upload.path,
name: uploadedFile.name,
}
plugins.fireHook( 'filter:uploadStored', { uploadedFile: uploadedFile, storedFile: storedFile } );
* Corrections per PR. Should match style guide.
* Correction attempts take 2.
Per:
/home/travis/build/NodeBB/NodeBB/src/controllers/uploads.js
234:5 error Missing semicolon semi
235:3 error Expected indentation of 3 tabs but found 2 indent
235:19 error There should be no spaces inside this paren space-in-parens
235:105 error There should be no spaces inside this paren space-in-parens
236:3 error Expected indentation of 3 tabs but found 2 indent
* next() shouldn't fire twice, but I see no documentation suggesting that the paramaters will fire correctly.
Previous comments imply it is preferred to have fireHook fire fof the callback rather than having it happen next, so I'm wrapping next in an anonymous function to ensure it passes the parameters.
If this is not the preferred method, please provide a thorough correction.
* Meh. Figuring out this style requirement is so hit and miss.
* Corrected for proper callback? technique.
Might blow up on style. Will watch.