Repository navigation
Conversation
…registration messages - website_event_compassion: new staff-only field profile_picture_original holds the uploaded picture as received (attachment auto-resize skipped), refreshed on each new upload; download button on the registration form. - The "New registration" note to the event responsible and the Muskathlon registration e-mail link the original through the login page. - Unreadable (e.g. HEIC) or oversized pictures are refused with a message naming JPG/PNG instead of the website form's generic error; the upload fields only offer JPG and PNG. - fr/de/it translations, tests in both modules.
The original picture is downloaded as "<participant name>.<jpg|png>" instead of event.registration-<id>-profile_picture_original, from the e-mail links and from the registration form.
ecino
left a comment
There was a problem hiding this comment.
This review is AI-generated (Claude Code) and has not been verified line by line.
Is the new field really needed?
Probably not. The existing profile_picture is capped in two places only:
- the field-level
max_width/max_height(MAX_PROFILE_PICTURE_DIMENSION), - Odoo's attachment auto-resize (
base.image_autoresize_max_px), which the PR already bypasses withimage_no_postprocess.
Dropping the field-level cap, writing profile_picture under image_no_postprocess in create/write, and pointing the download link at profile_picture would serve full quality with a single binary. Web pages already request resized versions (/web/image/.../1024x1024), so they are unaffected. This would remove profile_picture_original, profile_picture_original_filename, the sudo context method, the risk of the two pictures diverging, and one extra copy of each upload in the filestore. The only trade-off: _check_profile_picture_min_size would read the uncapped picture (a short note is enough).
Other points
_check_profile_picture_formatdoes not catch Pillow'sDecompressionBombError(not aValueError/OSError): a ~180 Mpx image still gives the generic form error.- "My events" edit form: the upload goes through the wizard's related
fields.Imagefirst, so the new validation may never run there. Tests only callcreate/writedirectly. copy(): the duplicate gets the already capped picture as its "original", and the new format check ignoresSKIP_PROFILE_PICTURE_CHECK.- Validation accepts any format Pillow opens while the message and
acceptsay JPG/PNG;acceptis missing in the form-builder field definitions (registration_form_snippet.esm.js). muskathlon/data/registration_mail_template.xml: calling the privateobject.sudo()._get_profile_picture_download_url()from QWeb is fragile; pass the URL viarender_valuesinstead. The link also leads non-staff followers to an access error after login.- The upload is base64-decoded and parsed 4-5 times per request; decode once.
profile_picture_original_filenameis stored once, can end up as just.jpg, and does not follow partner renames (would be better computed, or gone if the field is dropped).
Review of #440: profile_picture is no longer resized (field cap and attachment auto-resize), so the staff download it as uploaded and the profile_picture_original fields are dropped. The download link is named after the participant when the message is sent, and is passed to the Muskathlon mail as a render value. Pictures Pillow refuses to open (decompression bomb) get the 'too large' message, and a duplicate skips the upload checks.
|
Thanks for the review. Changes are in 31f1e4e (plus a merge of the latest 18.0):
9 tests pass. PR description updated. |
The picture is now stored as uploaded for the staff. The public photo route served it in full when no size was asked, with the photo's metadata (GPS position...). Without a size it now serves 1920 px at most, as before.
|
@greptileai review |
[T3630] Keep the participant's original photo and link it in the new registration messages
Branch
T3630-participant-original-photoin compassion-website, based onorigin/18.0:1be124d7original photo, download links, clear upload error, testsdcd0947edownload named after the participant31f1e4e4review: keep the uploaded picture itself instead of a second copyaf0ba830merge of the latest 18.0e0eb6deepublic photo route: bounded size, no metadatac218b750merge of the latest 18.0Problem
When someone registers for a Muskathlon or a trip, the profile picture they upload is only stored resized (500 px before, 1920 px since T3266). The file as uploaded is not kept anywhere, so the events team has to ask participants again for an HD version for print material. The "New Muskathlon registration" e-mail lists the registration details but has no way to get the picture.
While testing, two more issues showed up:
base.image_autoresize_max_px).Change
website_event_compassion:profile_pictureis stored as uploaded: no size cap on the field anymore, and it is written without the attachment auto-resize (image_no_postprocess). Web pages are unaffected: they already request resized versions (/web/image/.../1024x1024,/event/registration/<id>/photo/<size>), the shop line image and the partner image keep their own caps.<participant name>.jpg(or.png, from the stored file's type), named when the message is sent./web/login?redirect=...: logged-in staff download directly, logged-out staff log in first (the download alone answers Not Found when logged out).accept), so iPhones convert HEIC photos to JPEG by themselves./event/registration/<id>/photo) never gives the stored original: without a size it serves 1920 px at most, as before this change. Resizing also removes the photo's metadata (GPS position, camera…). The pages already ask for smaller sizes.muskathlon:fr/de/it translations for all new texts.
Pictures uploaded before this change cannot be recovered: only the resized version was ever stored.
Review of the first version
The first version kept a second field,
profile_picture_original, beside the capped picture. Following the review, it is gone: one picture, stored as uploaded. This also removes the duplicate copy in the filestore, the stored file name, and the case where a duplicated registration got the capped picture as its "original". No migration is needed: the field never reached 18.0 or stage.Not changed from the review:
write()untouched. A test now covers it.acceptin the form builder (registration_form_snippet.esm.js): Odoo 18's website form editor has noacceptoption for file fields, so it would need an override of the core template.Tests
website_event_compassion/tests/test_profile_picture_original.py: JPG and PNG pictures kept at 4000 x 3000 and their download named after the participant with the right extension; same through the "My events" edit form; an unreadable (HEIC) file and a decompression-bomb picture are refused; a duplicate keeps its picture; the event note contains the download link; no link without a picture.website_event_compassion/tests/test_public_photo.py: a 4000 x 3000 JPG with GPS and camera metadata comes back from the public route at 1920 x 1440 without metadata; a requested size is still served.muskathlon/tests/test_registration_notification.py: the registration e-mail contains the link; no link without a picture.11 tests pass.
Manual test: register on a Muskathlon event with a large JPG; the "New Muskathlon registration" e-mail and the event's "New registration" note contain the link, which downloads the full-size picture named after the participant (after login if needed). Uploading a HEIC file shows the JPG/PNG message instead of the generic error.
Deploy
-u website_event_compassion,muskathlon🤖 Generated with Claude Code