Skip to content

Elastic: Show contact photo in recipient autocomplete list - #10272

Open
listumps wants to merge 1 commit into
roundcube:masterfrom
listumps:feature/autocomplete-contact-photo
Open

Elastic: Show contact photo in recipient autocomplete list#10272
listumps wants to merge 1 commit into
roundcube:masterfrom
listumps:feature/autocomplete-contact-photo

Conversation

@listumps

@listumps listumps commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Shows the contact's vCard photo instead of the generic person icon in the To/Cc/Bcc recipient autocomplete dropdown when composing, when a photo is available.
  • The photo is already parsed on every autocomplete search (rcube_contacts::search() always reads the vCard), so this adds no extra query cost - autocomplete.php just exposes a URL to the existing contacts/photo action per matching contact.
  • Photos stored as external http(s):// URLs are intentionally excluded: contacts/photo.php 302-redirects the browser to those, and attaching one here would fire a silent third-party request on every keystroke for any matching contact, rather than only when a contact/email is deliberately opened.
  • Both ksearch_results_display() in app.js and Elastic's own override of it in ui.js (used for its small-screen layout) needed updating, since the skin's override completely replaces the base implementation.
  • The photo is capped to the existing .listing row height (@listing-line-height) and keeps its natural aspect ratio rather than being cropped to a circle, consistent with how photos are shown elsewhere in the app (Contacts page, sender photo in message preview).
  • Contacts without a photo, and group/distribution-list entries, keep the existing icon unchanged.

Test plan

  • Verified via php -l and the project's .php-cs-fixer.dist.php config (0 fixable issues) for autocomplete.php
  • Verified via eslint (project config) for app.js and ui.js
  • Verified the .less change compiles cleanly via lessc against the full styles.less entry point
  • Manually tested end-to-end on a live instance: composing a message and searching for a contact with a vCard photo shows the photo in the dropdown; contacts without a photo and group entries still show the default icon
  • Automated test coverage - none added; happy to add if maintainers want it

Show the contact's vCard photo instead of the generic icon in the
To/Cc/Bcc autocomplete dropdown, when available. The photo is
already parsed on every autocomplete search (rcube_contacts::search()
always reads the vCard), so this adds no extra query cost.

autocomplete.php exposes a photo URL per matching contact, skipping
external http(s):// photos since contacts/photo.php redirects to
those - attaching one here would fire a silent third-party request
on every keystroke instead of only when a contact is deliberately
opened. Both ksearch_results_display() in app.js and Elastic's
ui.js override of it (used for its small-screen layout) render the
photo in place of the icon when present.
@listumps
listumps force-pushed the feature/autocomplete-contact-photo branch from 2763b71 to 7a405aa Compare July 16, 2026 17:51
@listumps

Copy link
Copy Markdown
Contributor Author

Removed the CHANGELOG.md entry from this PR, following the guidance given to @MiMoHo on another PR (changelog entries create unnecessary merge conflicts between PRs). Force-pushed the amended commit - PR now only touches the 4 code files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant