Profile pictures: upload + serving, initials fallback, admin kebab with moderation remove #757

Closed
opened 2026-09-25 23:39:45 +00:00 by Cordy · 0 comments
Owner

Round 5 of the #695 deep dive (approved mockup, OpenCloud account/information as reference).

Server

  • PUT /api/v1/me/avatar — raw JPG/PNG body, 10 MB cap. Decode (stdlib image/jpeg+png), center-crop square, downscale to 256 px with the golang.org/x/image/draw machinery the preview pipeline already depends on, re-encode as JPEG: EXIF/metadata and oversized canvases never survive the server.
  • Stored as avatars/<user>.jpg beside the state files (same dir as settings/notify — rides the #138 state-in-backend migration later).
  • DELETE /api/v1/me/avatar (self), DELETE /api/v1/admin/avatar/{user} (admin moderation).
  • GET /api/v1/avatar/{user} for any authenticated user; ETag + Cache-Control like the thumb route; plain 404 when none.

Web

  • Profile gains a "Profile picture" card ABOVE the display-name card: centered round picture, Upload (native file picker) / Remove, hint "Max. 10 MB, JPG or PNG. Cropped to a square and stored at 256 px."
  • Picture shows on the top-right avatar button, the account-menu identity block, and shareAvatar() chips; initials stay the single fallback rule (#657) — the frontend falls back on 404 / image error. Owner column stays text.
  • Admin → Users → Accounts: per-row actions collapse into a kebab menu (4th action = time for a menu): local rows Reset password / Make–Remove admin / Remove picture / Delete user (renamed from "Remove", danger-styled + separated to prevent misclicks vs picture removal); directory rows Make–Remove admin / Remove picture. Existing danger-dialog confirms kept.
  • i18n ×4 for all new copy.
Round 5 of the #695 deep dive (approved mockup, OpenCloud account/information as reference). **Server** - `PUT /api/v1/me/avatar` — raw JPG/PNG body, 10 MB cap. Decode (stdlib image/jpeg+png), center-crop square, downscale to 256 px with the `golang.org/x/image/draw` machinery the preview pipeline already depends on, re-encode as JPEG: EXIF/metadata and oversized canvases never survive the server. - Stored as `avatars/<user>.jpg` beside the state files (same dir as settings/notify — rides the #138 state-in-backend migration later). - `DELETE /api/v1/me/avatar` (self), `DELETE /api/v1/admin/avatar/{user}` (admin moderation). - `GET /api/v1/avatar/{user}` for any authenticated user; ETag + Cache-Control like the thumb route; plain 404 when none. **Web** - Profile gains a "Profile picture" card ABOVE the display-name card: centered round picture, Upload (native file picker) / Remove, hint "Max. 10 MB, JPG or PNG. Cropped to a square and stored at 256 px." - Picture shows on the top-right avatar button, the account-menu identity block, and `shareAvatar()` chips; **initials stay the single fallback rule (#657)** — the frontend falls back on 404 / image error. Owner column stays text. - Admin → Users → Accounts: per-row actions collapse into a **kebab menu** (4th action = time for a menu): local rows Reset password / Make–Remove admin / Remove picture / **Delete user** (renamed from "Remove", danger-styled + separated to prevent misclicks vs picture removal); directory rows Make–Remove admin / Remove picture. Existing danger-dialog confirms kept. - i18n ×4 for all new copy.
Cordy closed this issue 2026-09-26 00:24:25 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#757
No description provided.