Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Single step invite and process partner process capability #4075

Conversation

vincent-truong-dev
Copy link
Contributor

@vincent-truong-dev vincent-truong-dev commented Feb 1, 2024

Closes #3432

Checklist:

  • I have performed a self-review of my own code,
  • I have commented my code, particularly in hard-to-understand areas,
  • I have made corresponding changes to the documentation,
  • I have added tests that prove my fix is effective or that my feature works,
  • New and existing unit tests pass locally with my changes ("bundle exec rake"),
  • Title include "WIP" if work is in progress.

Description

Certain banks want to skip the approval process and simply invite and approve an agency in a single step so this PR:

  • Allows the organization show and edit page to set new setting "Single step invite and approve partner process"
  • Adds Invite and approve button to partner agency which invites and approves a partner when clicked.

Type of change

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

How Has This Been Tested?

Ran specs

QA Test

Enabling/disabling the feature

  1. Login as super admin
username: superadmin@example.com
  password: password!
  1. Navigate to http://localhost:3000/diaper_bank/organization
  2. Click Edit
  3. Check Use single step invite and approve partner process to yes if no, or no if yes.
  4. Refresh screen see that it is set to yes if no, and no if yes.

**Inviting and approving w/ setting on **

  1. Create a new user in Partner agency page
  2. See uninvited user has action Invite and approve
  3. Click Invite and approve
  4. See user is Approved afterwards

With setting off

  1. Create a new user
  2. See uninvited user has action `Invite

Screenshots

Screenshot 2024-02-02 at 1 39 20 PM Screenshot 2024-02-02 at 1 39 29 PM Screenshot 2024-02-02 at 2 10 52 PM Screenshot 2024-02-02 at 2 11 14 PM

@vincent-truong-dev vincent-truong-dev changed the title 3432 add invite and approve capability Add Single step invite and process partner process capability Feb 1, 2024
@vincent-truong-dev vincent-truong-dev force-pushed the 3432-add-invite-and-approve-capability branch 2 times, most recently from 95170f4 to e3d71ab Compare February 1, 2024 21:08
@vincent-truong-dev vincent-truong-dev marked this pull request as ready for review February 1, 2024 21:19
Comment on lines +1 to +15
# == Schema Information
#
# Table name: events
#
# id :bigint not null, primary key
# data :jsonb
# event_time :datetime not null
# eventable_type :string
# type :string not null
# created_at :datetime not null
# updated_at :datetime not null
# eventable_id :bigint
# organization_id :bigint
# user_id :bigint
#
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The app added this. Doesn't detract from the change, and I think it's more useful to have. Opting to keep it in.

db/schema.rb Outdated Show resolved Hide resolved
db/schema.rb Outdated
@@ -839,7 +839,8 @@
end

create_table "versions", force: :cascade do |t|
t.string "item_type", null: false
t.string "item_type"
t.string "{:null=>false}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I added not null constraint, got this. Don't think it should be here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That is really weird... maybe it was a mistake that happened while you were developing? Check your database table for versions and drop this column if it exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it since it shouldn't be there.

Copy link
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

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

Great first draft! I had some suggestions/comments.

@@ -97,7 +97,8 @@ def organization_params
:repackage_essentials, :distribute_monthly,
:ndbn_member_id, :enable_child_based_requests,
:enable_individual_requests, :enable_quantity_based_requests,
:ytd_on_distribution_printout, partner_form_fields: []
:ytd_on_distribution_printout,:use_single_step_invite_and_approve_partner_process ,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like a mouthful... can we rename it to something smaller, like single_step_partner_invite?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about one_step_partner_invite. Saw it somewhere mentioned in a previous attempt at the ticket. Flows better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed.

app/controllers/partners_controller.rb Show resolved Hide resolved
@@ -130,6 +130,11 @@ def invite_button_to(link, options = {}, properties = {})
_link_to link, { icon: "envelope", type: "warning", text: "Invite", size: "xs" }.merge(options), properties
end

def invite_and_approve_button_to(link, options = {}, properties = {})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you need a separate helper here? You should be able to reuse existing helpers and just pass the text and icon into it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, I changed it to reuse existing helper.

app/controllers/partners_controller.rb Outdated Show resolved Hide resolved
db/schema.rb Outdated
@@ -839,7 +839,8 @@
end

create_table "versions", force: :cascade do |t|
t.string "item_type", null: false
t.string "item_type"
t.string "{:null=>false}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

That is really weird... maybe it was a mistake that happened while you were developing? Check your database table for versions and drop this column if it exists.


click_on "Save"
expect(page).to have_content("Yes")
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

There should be a request spec that checks the correct button being shown on the partners page based on the value of the flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@vincent-truong-dev vincent-truong-dev force-pushed the 3432-add-invite-and-approve-capability branch 8 times, most recently from 1a7b5c9 to 656b34c Compare February 2, 2024 19:28
Copy link
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

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

This looks good! Thanks for the contribution!

@dorner
Copy link
Collaborator

dorner commented Feb 2, 2024

@vincent-truong-dev there are some failing checks - can you please address them?

@vincent-truong-dev vincent-truong-dev force-pushed the 3432-add-invite-and-approve-capability branch from 1b00ce9 to eb5a841 Compare February 3, 2024 00:24
@vincent-truong-dev
Copy link
Contributor Author

vincent-truong-dev commented Feb 3, 2024

@vincent-truong-dev there are some failing checks - can you please address them?

Addressed the failing checks, thanks. Do you need to approve the workflows for CI to run again? @dorner

@dorner
Copy link
Collaborator

dorner commented Feb 4, 2024

@vincent-truong-dev Sorry - still some failures!

@vincent-truong-dev vincent-truong-dev force-pushed the 3432-add-invite-and-approve-capability branch from e8d5ee7 to 706b010 Compare February 4, 2024 15:50
@vincent-truong-dev vincent-truong-dev force-pushed the 3432-add-invite-and-approve-capability branch from 706b010 to 2377839 Compare February 4, 2024 15:56
@vincent-truong-dev
Copy link
Contributor Author

vincent-truong-dev commented Feb 4, 2024

@vincent-truong-dev Sorry - still some failures!

Ok, it's good now! @dorner

@dorner
Copy link
Collaborator

dorner commented Feb 7, 2024

@vincent-truong-dev now there's a conflict. 😭

@vincent-truong-dev
Copy link
Contributor Author

vincent-truong-dev commented Feb 7, 2024

@vincent-truong-dev now there's a conflict. 😭

Conflict addressed. 🤞 @dorner

@dorner dorner merged commit f8caf36 into rubyforgood:main Feb 7, 2024
11 checks passed
@dorner
Copy link
Collaborator

dorner commented Feb 7, 2024

Awesome! Thanks for your contribution!

Copy link
Contributor

@vincent-truong-dev: Your PR Add Single step invite and process partner process capability is part of today's Human Essentials production release: 2024.02.11.
Thank you very much for your contribution!

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.

Allow banks to skip partner approval process on an opt-in basis
2 participants