Feature #159

avatar

make image events more generic

Added by JJS - 962 days ago. Updated 962 days ago.

Status:New Start:
Priority:Normal Due date:
Assigned to:avatarShish - % Done:

0%

Category:default extensions
Target version:2.X

Description

Currently the checks being performed are split between ext/upload and the add_image function in ext/image. I think ext/upload should simply fire off the ImageUploadingEvent and let ext/image handle all sanity checking. This would make extensions which also upload images (cough danbooru api and eventually shimmie api) not have to duplicate code.

Instead of making html error messages, the event should actually make use of the event veto functionality (by setting veto_reason with a defined error message like IMAGEUPLOAD_TOOLARGE or IMAGEUPLOAD_DUPLICATE) and let ext/upload (or whatever extension happens to send the event) handle turning that error constant into html. This would save me from having to duplicate the dupe/too large checking code in, for example, the danbooru api :)

Basically, ext/image's events like UploadingImageEvent and ImageDeletionEvent should not try to output any html but simply return constant error flags (or none and simply return true when successful as it does currently). Leave the presentation to the extension since it may or may not be outputting html (could be xml like mine :P). This should also be applied to other generic events like comments and such.

Also available in: Atom PDF