revoltchat / backend

Monorepo for Revolt backend services.
https://developers.revolt.chat/api/
Other
1.14k stars 125 forks source link

feat: ability to mark attachments as spoilers on upload #346

Open insertish opened 3 years ago

Iikorni commented 2 years ago

I'm interested in seeing if I could tackle this - it seems deceptively simple, albeit I'd have some basic spitball-y questions about the approach. I might be overthinking this a bit, but I'm wondering what the best way to signal the client that the attachment should be "spoilered" might be. I know Discord seemingly uses the approach of literally just appending SPOILER_ to the name of the file and seemingly reacting to that, but that seems a bit clunky? Perhaps it's the best form of in-band signaling there is, but I feel like it misses the point a bit. Database wise, this shouldn't be much harder than adding a new field on the entity for files, but I'm just wondering where to go from there.

Sorry, this is a bit of a ramble - just looking to get your thoughts on it.

MagnusHJensen commented 1 year ago

Would a viable solution be to just prefix files that are marked as spoiler with SPOILER_ and then the frontend handles actually blurring the file?

acceleratorlastorder commented 1 month ago

S3 does support metadata; it could simply be metadata. But in my opinion the best approach would be to implement that in the database that handles the message/chat, not the file server, but that's just me rambling.