Skip to content

Add optional phone number to users - #5726

Open
costajohnt wants to merge 1 commit into
rubyforgood:mainfrom
costajohnt:feat/user-phone-number
Open

costajohnt wants to merge 1 commit into
rubyforgood:mainfrom
costajohnt:feat/user-phone-number

Conversation

@costajohnt

Copy link
Copy Markdown
Contributor

Resolves #5687

Description

Banks sometimes need to call an individual partner user, not only the partner's formal contacts. This adds a nullable phone_number string to users (same shape as the phone_number added to partners in 8317eae, no validation, same as vendors and donation sites) and exposes it wherever a user is invited or edited:

  • Bank managing partner users (/partners/:id/users): a Phone Number field on the invite form, saved through UserInviteService, shown under the email in the users table.
  • Partner's own user management (Partners::UsersController): invite form, the user's edit form, and a Phone column on the list.
  • Admin user and organization forms (they share _user_form_fields), including both create paths.
  • Account settings (/users/edit), through the Devise account_update sanitizer.

UserInviteService only sets the phone on newly invited users. When an existing user is re-invited to another resource their record is not touched, which is what already happens with name.

One thing I left alone: blank values from the edit forms are stored as "" while the invite path stores nil (.presence). Neither is rendered differently and it matches how Partner#phone_number behaves; happy to add a normalizes if you'd rather have nil everywhere.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • spec/requests/partner_users_requests_spec.rb: invite persists the phone; the users page renders it.
  • spec/requests/partners/user_requests_spec.rb: partner-side invite and self-edit persist it.
  • spec/requests/admin/users_requests_spec.rb and spec/requests/admin/organizations_requests_spec.rb: admin create and update persist it.
  • spec/requests/users/registrations_requests_spec.rb (new): account settings update persists it.
  • Each of the five permits and the invite assignment has an assertion that fails when it is removed (Rails drops the unpermitted param silently, so the reload assertions are the check). bundle exec rubocop and bundle exec erb_lint are clean on the changed files.

Banks sometimes need to call an individual partner user, not only the
partner's formal contacts. Add a nullable phone_number to users and expose
it wherever a user is invited or edited: the bank's partner-user page,
the partner's own user management, the admin user and organization forms,
and account settings.

Resolves rubyforgood#5687
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.

Add optional phone number to users (esp Partner Users)

1 participant