File attachment related hooks
-
I've been trying to get a few tweaks made on the fileownership plugin I started last week along with another of mine that is dependent upon its data and I've run into a wall.
As posted last week, it was listening for the fileUpload hook. The problem with that is you end up putting data in the database for a file that might be decoupled from the message ( deleted, etc. ) and then you end up with file references cluttering the database.
Today I moved it to the topicPost/topicReply filter. This was a little better in that I knew I was dealing with the final state of the attached files for an initial post/reply ( fails utterly with edits... ) message but the file has not been moved/cloned from "/tmp" to the nodebb filesystem making it difficult to get any metadata ( size, etc ) from the file.
I tried moving it to the topicPost/topicReply actions, which occur later - but it was rather inconsistent.
This has me thinking a few things.
One - I'm doing a lot of this wrong headed and I need to completely rethink storage to account for editing messages.
Two - I need a hook that fires after the file has been moved from the tmp filesystem into the nodebb space. Does one exist?