[draft] feat(#10662): display contact profile photo#11087
Open
benkags wants to merge 18 commits into
Open
Conversation
…rt forms When a report form contains [db-doc="true"] sub-documents with binary/file fields, attachments are now routed to the owning sub-document instead of always attaching to the main report doc. - Add resolveOwnerDoc() to walk up XML tree to nearest db-doc ancestor - Route FileManager file uploads to correct owner doc - Route inline binary blobs to correct owner doc - Fall back to main report doc when element is not inside a sub-doc
processAllAttachments now walks the parsed XML to determine which prepared doc owns each [type=binary] element (main / sibling / repeat child) and attaches files accordingly, instead of dumping every upload on preparedDocs[0]. Field-value sanitization and orphan cleanup also run per-doc. Adds two private helpers: - resolveContactOwnerDoc: DOM-walk from any element to its section root, then to the owning prepared doc (with mainDoc fallback). - findContactOwnerForFilename: locates the [type=binary] node whose text matches a FileManager filename and resolves its owner. No public API changes; no new service dependencies.
saveContact now uses validateAttachments(preparedDocs.preparedDocs)
New 'attachment routing to sub-contacts' describe block exercising: - file uploaded inside a sibling section -> sibling doc - file uploaded inside a repeat child -> i-th repeat doc - mixed uploads across main / sibling / repeat -> each owner - FileManager file with no matching binary node -> main doc fallback - inline binary (draw widget) inside sibling -> sibling doc - per-doc field-value sanitization (sibling field rewritten, main untouched) - main-doc orphan cleanup on edit path with per-doc loop
- main-doc & sub-doc oversize attachment fails saveContact - normal-sized attachment passes validation
Enketo's setVal rewrites uploaded binary nodes to type="file" the moment a value is set.
…oc attachments - findFileNodeByFilename now selects [type=file], matching Enketo's runtime XML state - use doc.form for the xpath-rooted filename - additional tests: orphan file fallback, db-doc nested in repeats, and filename shape for sub-doc binaries.
Standalone Angular component that resolves a contact's photo attachment via DbService and renders an <img>, falling back to the type icon on 404 or missing field.
Replaces the resource-icon span in contacts-content with mm-contact-photo so a contact's uploaded photo renders in the heading, falling back to the type icon otherwise.
Adds an optional photo_field to the ContactType schema and sets the default person type to use it, letting form authors configure which doc field holds the profile photo per contact type.
Adds two scenarios asserting the photo renders in the heading when uploaded and falls back to the type icon otherwise.
Rename the default photo field from `photo` to `profile_photo` across the component default, the `person` contact-type config, unit tests, and the e2e custom type / XML forms / spec. Add `border-radius: 50%` and `object-fit: cover` to the contact photo so rectangular or opaque uploads display as a clean circle in the profile header.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add the ability to display the profile photo of the user when provided in the contact profile. The profile photo field is configurable in contact type definition.
Code review checklist
can_view_old_navigationpermission to see the old design. Test it has appropriate design for RTL languages.License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.