Skip to content

feat: verify mentor's avatar is a real picture#1011

Draft
Copilot wants to merge 8 commits intomasterfrom
copilot/add-face-detection-for-profile-picture
Draft

feat: verify mentor's avatar is a real picture#1011
Copilot wants to merge 8 commits intomasterfrom
copilot/add-face-detection-for-profile-picture

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 5, 2026

Summary

  • Adds client-side face-detection checks for profile avatars and improves avatar UX.
  • Wording: changed warning to: "Please use a real photo of yourself." in Avatar components.
  • For Google OAuth users, if we can’t detect a face (or Google avatar fails to load) we show a warning and offer switching to Gravatar.
  • Tests: added unit tests (Avatar, AvatarField, AvatarField.imageError) and test setup (src/setupTests.ts). Updated tsconfig types for jest/jest-dom.

Notes on tests

  • The image-error test is intentionally tolerant: jsdom image load/error behavior varies by environment, so the test accepts either the Google-warning flow or the placeholder fallback. A comment in the test explains this and how to make it deterministic by mocking global Image in tests.

Next steps (refactor proposal)

  1. Extract shared warning UI and avatar logic into a single AvatarPresenter component (DRY/SOC).
  2. Centralize avatar source resolution (Google vs Gravatar) and provider links in a small service/helper.
  3. Add test factories and mocks for user states and face-detection results to remove duplication in tests.
  4. Add deterministic image behavior in test setup or use per-test Image mocking to reliably test image error/loaded flows.
  5. Add E2E test (Cypress) to validate real browser image/Google avatar behavior.

If this looks good I can start the refactor (small, focused PRs). Please review and let me know any changes you want in the PR description.

Copilot AI changed the title [WIP] Add face detection validation for profile pictures Emphasize real face photo requirement and suggest Gravatar for Google OAuth users Apr 5, 2026
Copilot AI requested a review from moshfeu April 5, 2026 14:51
@moshfeu moshfeu changed the title Emphasize real face photo requirement and suggest Gravatar for Google OAuth users feat: verify mentor's avatar is a real picture Apr 11, 2026
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.

[become of mentor form] Emphesize that picture profile must be a real one

2 participants