Skip to main content

[Employer Sync 6.4] Non-blocking prompt for migrated employers to set their real personal mobile

TL;DR: Detect is_placeholder_mobile? on Identities::User, expose it in the session response, and show a dismissible top banner asking the employer to set their real mobile. Non-blocking — posting jobs still works. This is what unlocks WhatsApp / SMS notifications.

Context

Migrated employers arrive in JodApp with a placeholder mobile because their JodGig contact_number is an office number, shared across many sub-accounts (one office number is used by 107 employers), and Identities::User.mobile is UNIQUE. The placeholder format is produced by JodGig::ContactNumberService.generate_invalid_format.

The business wants transactional notifications via WhatsApp (with SMS as backup) — for example, a WhatsApp flow asking an employer to accept or reject candidates from their phone, without opening the dashboard. That needs a real personal mobile on the Identities::User.

Problem

There is no flow today in jodapp-web that asks an employer to set their personal mobile after first login. A migrated employer never updates the placeholder, and WhatsApp notifications never reach them.

Direction

Two pieces, frontend and a tiny backend hook.

Backend. Add a helper on Identities::Useris_placeholder_mobile? — that returns true when mobile matches the format produced by JodGig::ContactNumberService.generate_invalid_format. Expose this flag in the session response (or in the me endpoint, whichever the frontend already polls). If an update endpoint for mobile does not already exist, add a small one (PATCH /identities/users/me with mobile + phone_code); validate the input through the existing mobile regex.

Frontend (jodapp-web). On first login after a migration:

  • Detect is_placeholder_mobile === true from the session data.
  • Render a non-blocking banner on the top of every employer page: Add your personal mobile number to receive WhatsApp updates from JodApp. with a small Add button.
  • Clicking opens a modal with two fields — Phone Code (default 65) and Mobile Number — using the existing SelectField and MobileField components.
  • On submit, call the new patch endpoint; on success, set is_placeholder_mobile = false locally; on dismiss, hide the banner for this session but show it again on next login.
  • The banner does not appear once a real mobile is set.

Do not block any flow. Posting jobs still works without the real mobile.

Acceptance

  • Identities::User#is_placeholder_mobile? exists and is exposed in the session payload.
  • Banner appears for placeholder-mobile users; does not appear once a real mobile is set.
  • Submitting the modal updates mobile + phone_code and clears the banner.
  • Tests cover the placeholder-detection helper, the patch endpoint, and the banner-render path.