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

Revert "Add Single step invite and process partner process capability" #4088

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ 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, :one_step_partner_invite,
partner_form_fields: []
:ytd_on_distribution_printout, partner_form_fields: []
)
end

Expand Down
22 changes: 0 additions & 22 deletions app/controllers/partners_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,6 @@ def approve_application
end
end

def invite_and_approve
# Invite the partner
partner = current_organization.partners.find(params[:id])

partner_invite_service = PartnerInviteService.new(partner: partner, force: true)
partner_invite_service.call

# If no errors inviting, then approve the partner
if partner_invite_service.errors.none?
partner_approval_service = PartnerApprovalService.new(partner: partner)
partner_approval_service.call

if partner_approval_service.errors.none?
redirect_to partners_path, notice: "Partner invited and approved!"
else
redirect_to partners_path, error: "Failed to approve partner because: #{partner_approval_service.errors.full_messages}"
end
else
redirect_to partners_path, notice: "Failed to invite #{partner.name}! #{partner_invite_service.errors.full_messages}"
end
end

def show
@partner = current_organization.partners.find(params[:id])
@impact_metrics = @partner.impact_metrics unless @partner.uninvited?
Expand Down
55 changes: 27 additions & 28 deletions app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,33 @@
#
# Table name: organizations
#
# id :integer not null, primary key
# city :string
# deadline_day :integer
# default_storage_location :integer
# distribute_monthly :boolean default(FALSE), not null
# email :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# intake_location :integer
# invitation_text :text
# latitude :float
# longitude :float
# name :string
# partner_form_fields :text default([]), is an Array
# reminder_day :integer
# repackage_essentials :boolean default(FALSE), not null
# short_name :string
# state :string
# street :string
# url :string
# one_step_partner_invite :boolean default(FALSE), not null
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
# account_request_id :integer
# ndbn_member_id :bigint
# id :integer not null, primary key
# city :string
# deadline_day :integer
# default_storage_location :integer
# distribute_monthly :boolean default(FALSE), not null
# email :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# intake_location :integer
# invitation_text :text
# latitude :float
# longitude :float
# name :string
# partner_form_fields :text default([]), is an Array
# reminder_day :integer
# repackage_essentials :boolean default(FALSE), not null
# short_name :string
# state :string
# street :string
# url :string
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
# account_request_id :integer
# ndbn_member_id :bigint
#

class Organization < ApplicationRecord
Expand Down
6 changes: 0 additions & 6 deletions app/views/organizations/_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,6 @@
<%= humanize_boolean(@organization.ytd_on_distribution_printout) %>
</p>
</div>
<div class="mb-4">
<h3 class='font-bold'>Use One step Partner invite and approve process?</h3>
<p>
<%= humanize_boolean(@organization.one_step_partner_invite) %>
</p>
</div>
<% if @organization.logo.attached? %>
<div class="mb-4">
<h3 class='font-bold'>Logo</h3>
Expand Down
1 change: 0 additions & 1 deletion app/views/organizations/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
<%= f.input :enable_individual_requests, label: 'Enable partners to make requests for individuals?', as: :radio_buttons, collection: [[true, 'Yes'], [false, 'No']], label_method: :second, value_method: :first %>
<%= f.input :enable_quantity_based_requests, label: 'Enable partners to make quantity-based requests?', as: :radio_buttons, collection: [[true, 'Yes'], [false, 'No']], label_method: :second, value_method: :first %>
<%= f.input :ytd_on_distribution_printout, label: 'Show Year-to-date values on distribution printout?', as: :radio_buttons, collection: [[true, 'Yes'], [false, 'No']], label_method: :second, value_method: :first %>
<%= f.input :one_step_partner_invite, label: 'Use One Step Invite and Approve partner process?', as: :radio_buttons, collection: [[true, 'Yes'], [false, 'No']], label_method: :second, value_method: :first %>
<% default_email_text_hint = "You can use the variables <code>%{partner_name}</code>, <code>%{delivery_method}</code>, <code>%{distribution_date}</code>, and <code>%{comment}</code> to include the partner's name, delivery method, distribution date, and comments sent in the request." %>
<%= f.input :default_email_text, label: "Distribution Email Content", hint: default_email_text_hint.html_safe do %>
Expand Down
9 changes: 1 addition & 8 deletions app/views/partners/_partner_row.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<% status = partner_row.status %>
<% can_one_step_invite_and_approve = partner_row.organization.one_step_partner_invite %>

<tr>
<td class='text-blue-500'><%= link_to partner_row.name, partner_path(partner_row) %></td>
<td><%= link_to partner_row.email, "mailto:#{partner_row.email}" %></td>
Expand All @@ -27,12 +25,7 @@
<td>
<% case status %>
<% when "uninvited" %>
<% if can_one_step_invite_and_approve %>
<% button_options = { icon: "envelope", type: "warning", text: "Invite and Approve", size: "xs", confirm: "One step invite and approve #{partner_row.name} to begin using the partner application?" } %>
<%= invite_button_to(invite_and_approve_partner_path(partner_row), button_options) %>
<% else %>
<%= invite_button_to(invite_partner_path(partner_row), confirm: "Send an invitation to #{partner_row.name} to begin using the partner application?") %>
<% end %>
<%= invite_button_to(invite_partner_path(partner_row), confirm: "Send an invitation to #{partner_row.name} to begin using the partner application?") %>
<% when "invited" %>
<%= view_button_to partner_path(partner_row) + "#partner-information", { text: "Review Application", icon: "check", type: "warning" } %>
<%= invite_button_to(invite_partner_path(partner_row), confirm: "Re-send an invitation to #{partner_row.name}?", text: 'Re-send Invite') %>
Expand Down
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ def set_up_flipper
patch :profile
get :approve_application
post :invite
post :invite_and_approve
post :invite_partner_user
post :recertify_partner
put :deactivate
Expand Down

This file was deleted.

3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_01_31_202431) do
ActiveRecord::Schema[7.0].define(version: 2023_12_29_200106) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -478,7 +478,6 @@
t.boolean "enable_individual_requests", default: true, null: false
t.boolean "enable_quantity_based_requests", default: true, null: false
t.boolean "ytd_on_distribution_printout", default: true, null: false
t.boolean "one_step_partner_invite", default: false, null: false
t.index ["latitude", "longitude"], name: "index_organizations_on_latitude_and_longitude"
t.index ["short_name"], name: "index_organizations_on_short_name"
end
Expand Down
55 changes: 27 additions & 28 deletions spec/factories/organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,33 @@
#
# Table name: organizations
#
# id :integer not null, primary key
# city :string
# deadline_day :integer
# default_storage_location :integer
# distribute_monthly :boolean default(FALSE), not null
# email :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# intake_location :integer
# invitation_text :text
# latitude :float
# longitude :float
# name :string
# partner_form_fields :text default([]), is an Array
# reminder_day :integer
# repackage_essentials :boolean default(FALSE), not null
# short_name :string
# state :string
# street :string
# url :string
# one_step_partner_invite :boolean default(FALSE), not null
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
# account_request_id :integer
# ndbn_member_id :bigint
# id :integer not null, primary key
# city :string
# deadline_day :integer
# default_storage_location :integer
# distribute_monthly :boolean default(FALSE), not null
# email :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# intake_location :integer
# invitation_text :text
# latitude :float
# longitude :float
# name :string
# partner_form_fields :text default([]), is an Array
# reminder_day :integer
# repackage_essentials :boolean default(FALSE), not null
# short_name :string
# state :string
# street :string
# url :string
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
# account_request_id :integer
# ndbn_member_id :bigint
#

FactoryBot.define do
Expand Down
15 changes: 0 additions & 15 deletions spec/models/event_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
# == 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
#
RSpec.describe Event, type: :model do
let(:organization) { FactoryBot.create(:organization) }
describe "#most_recent_snapshot" do
Expand Down
55 changes: 27 additions & 28 deletions spec/models/organization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,33 @@
#
# Table name: organizations
#
# id :integer not null, primary key
# city :string
# deadline_day :integer
# default_storage_location :integer
# distribute_monthly :boolean default(FALSE), not null
# email :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# intake_location :integer
# invitation_text :text
# latitude :float
# longitude :float
# name :string
# partner_form_fields :text default([]), is an Array
# reminder_day :integer
# repackage_essentials :boolean default(FALSE), not null
# short_name :string
# state :string
# street :string
# url :string
# one_step_partner_invite :boolean default(FALSE), not null
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
# account_request_id :integer
# ndbn_member_id :bigint
# id :integer not null, primary key
# city :string
# deadline_day :integer
# default_storage_location :integer
# distribute_monthly :boolean default(FALSE), not null
# email :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# intake_location :integer
# invitation_text :text
# latitude :float
# longitude :float
# name :string
# partner_form_fields :text default([]), is an Array
# reminder_day :integer
# repackage_essentials :boolean default(FALSE), not null
# short_name :string
# state :string
# street :string
# url :string
# ytd_on_distribution_printout :boolean default(TRUE), not null
# zipcode :string
# created_at :datetime not null
# updated_at :datetime not null
# account_request_id :integer
# ndbn_member_id :bigint
#

RSpec.describe Organization, type: :model do
Expand Down
Loading
Loading