feat(chat,files): edit messages, pin several of them, drag-and-drop upload

Chat messages can now be rewritten by their author only, at any time, with a
"(edited)" marker whose tooltip carries the full date and time down to the
second. The edit is enforced by the SQL filter on user_id, so a message of
someone else answers 404, exactly like a message that does not exist.

Several messages can be pinned at once in the same chat room. Pinning is open
to every member of the room: it is a reading convenience, not a way to take
over someone else's content. A dedicated GET on /chat/pins is required because
the id cursor only reports recent messages, and pinning an old one would
otherwise stay invisible.

The message list is synchronised with two cursors: the id one for new
messages, a timestamp one for rewrites. The server computes that timestamp
before running the query and returns it as-is, in the very frame used by
edited_at, so the client never converts it and cannot drift by a timezone
offset.

Files can now be dropped on the current folder or on any sub-folder card. The
drop zone only reacts to file drags, and the pointer moving from a child
element to another no longer makes the overlay flicker.

A deleted message leaves the pinned list, and its physical file is removed
from the disk as before.
This commit is contained in:
2026-10-22 10:11:39 +02:00
parent cbe33bf563
commit 6fed804a02
9 changed files with 697 additions and 33 deletions
+21
View File
@@ -32,6 +32,27 @@ en-tête (`backend/src/access.ts`). Lecture : propriétaire, permission
`write`/`admin`. **404 plutôt que 403** : jamais d'indice sur l'existence d'une
ressource.
### Discussion
Le salon d'un dossier est ouvert à qui a accès au dossier (`canRead`). L'accès
en lecture et l'envoi de messages se distinguent de l'**édition** :
- l'édition d'un message (`PATCH .../chat/messages/:id`) est réservée à son
**auteur**, sans limite de temps. Le filtre `user_id` est porté par la
requête SQL : un message d'autrui répond `404`, comme un message inexistant,
sans rien laisser deviner. Le gestionnaire du dossier peut supprimer un
message mais pas le réécrire à la place de son auteur ;
- l'épinglage (`PUT .../chat/messages/:id/pin`) est ouvert à tout membre du
salon : c'est une mise de côté de lecture, pas une prise de contrôle du
contenu ;
- la suppression est un soft-delete (`deleted_at`), un message retiré quitte
aussi les épingles ;
- `edited_at` est posé par le serveur, jamais reçu du client : un client ne
peut pas dater sa propre modification.
Chaque écriture dans le salon passe par le limiteur de débit (20 requêtes
d'écriture par compte sur 10 s), édition et épinglage compris.
### Courriel
Nodemailer (`backend/src/lib/mail.ts`) avec `SMTP_HOST`. `PUBLIC_ORIGIN`