Skip to content

#1785 - admins can add/edit phone numbers for all users#3375

Merged
compwron merged 35 commits into
rubyforgood:mainfrom
xihai01:main
Apr 20, 2022
Merged

#1785 - admins can add/edit phone numbers for all users#3375
compwron merged 35 commits into
rubyforgood:mainfrom
xihai01:main

Conversation

@xihai01
Copy link
Copy Markdown
Collaborator

@xihai01 xihai01 commented Apr 15, 2022

What github issue is this PR for, if any?

Resolves #1785

What changed, and why?

Front-end: A phone number form field has been added to the edit profiles of admins, supervisors and volunteers.
Back-end: Phone number column added to users table.

How will this affect user permissions?

Admins can have the ability to add/edit phone numbers of other admins, supervisors and volunteers.

How is this tested? (please write tests!) 💖💪

  1. Request spec - update routes are tested for all roles to ensure admin can hit these routes to update phone number
  2. View spec - check that phone number form fields appear to be editable for admin
  3. System spec - check correct error messages show up in UI when phone numbers to be entered are invalid

phone

Feelings

Me dealing with Git/merging issues (hence I had to close other PR).
fortnight dance

xihai01 and others added 28 commits April 3, 2022 17:04
This reverts commit 3e795c3.

revert back to working point
@xihai01 xihai01 added zzz_archived: 📱 SMS work relating to SMS notifications #1017 codethechange code.the.change developers labels Apr 15, 2022
@xihai01 xihai01 requested review from compwron and harsohailB April 15, 2022 22:57
@xihai01 xihai01 self-assigned this Apr 15, 2022
@github-actions github-actions Bot added erb Touches ERB templates ruby Touches Ruby code zzz_archived: Tests no-skin-tone labels Apr 15, 2022
Comment thread app/models/user.rb
validates :email, presence: true
validates :display_name, presence: true

validates_with UserValidator
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're using the fancy validator, should we put all the existing validators in it also and remove them here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be a great issue to create for

def update_user_setting?
if is_supervisor?
# allow access to own record or volunteer record
return record == user || record.volunteer?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

permissions issue- must make sure that the volunteer belongs to the correct casa org

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread spec/system/casa_admins/edit_spec.rb Outdated
before do
visit edit_casa_admin_path(admin)
fill_in "Email", with: "newemail@example.com"
fill_in "Display name", with: "Kadehara Kazuha"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳 🥳 guess you found my easter eggs

Comment thread spec/system/supervisors/edit_spec.rb Outdated

context "with invalid data" do
let(:role) { "supervisor" }
let(:supervisor) { create(:supervisor, display_name: "Lesile Knope", casa_org: organization) }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sign_in admin
visit edit_volunteer_path(volunteer)
fill_in "volunteer_email", with: "newemail@example.com"
fill_in "volunteer_display_name", with: "Kamisato Ayato"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

@compwron compwron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just need to fix the permissions issue

@harsohailB harsohailB self-requested a review April 18, 2022 00:36
Copy link
Copy Markdown
Collaborator

@compwron compwron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is huge but great!

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

Labels

codethechange code.the.change developers erb Touches ERB templates ruby Touches Ruby code 🧪 Tests Tests zzz_archived: 📱 SMS work relating to SMS notifications #1017

Projects

None yet

Development

Successfully merging this pull request may close these issues.

admins can add/edit phone numbers for all users

3 participants