Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
get latest
  • Loading branch information
guswhitten committed Jul 25, 2024
2 parents b3586e8 + 1505576 commit b999f50
Show file tree
Hide file tree
Showing 56 changed files with 428 additions and 389 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
* @compwron @FireLemons @littleforest @elasticspoon
* @compwron @FireLemons @elasticspoon

/app/javascript/ @schoork @FireLemons @elasticspoon
16 changes: 8 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ GEM
cssbundling-rails (1.4.0)
railties (>= 6.0.0)
csv (3.3.0)
database_cleaner-active_record (2.1.0)
database_cleaner-active_record (2.2.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
Expand All @@ -177,10 +177,10 @@ GEM
docx (0.8.0)
nokogiri (~> 1.13, >= 1.13.0)
rubyzip (~> 2.0)
dotenv (2.8.1)
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
railties (>= 3.2)
dotenv (3.1.2)
dotenv-rails (3.1.2)
dotenv (= 3.1.2)
railties (>= 6.1)
draper (4.0.2)
actionpack (>= 5.0)
activemodel (>= 5.0)
Expand All @@ -206,7 +206,7 @@ GEM
factory_bot_rails (6.4.3)
factory_bot (~> 6.4)
railties (>= 5.0.0)
faker (3.4.1)
faker (3.4.2)
i18n (>= 1.8.11, < 2)
faraday (1.10.3)
faraday-em_http (~> 1.0)
Expand Down Expand Up @@ -486,7 +486,7 @@ GEM
nokogiri (>= 1.12.0)
scout_apm (5.3.8)
parser
selenium-webdriver (4.22.0)
selenium-webdriver (4.23.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
Expand Down Expand Up @@ -557,7 +557,7 @@ GEM
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.8.1)
websocket (1.2.10)
websocket (1.2.11)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand Down
25 changes: 25 additions & 0 deletions app/callbacks/case_contact_metadata_callback.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class CaseContactMetadataCallback
def after_commit(case_contact)
changes = case_contact.saved_changes

set_status(changes, case_contact) if changes["id"]
update_status(changes, case_contact) if changes["status"] && changes["id"].nil?
end

private

def set_status(changes, case_contact)
metadata = {"status" => {case_contact.status => case_contact.created_at}}
update_metadata(case_contact, metadata)
end

def update_status(changes, case_contact)
metadata = {"status" => {changes["status"].last => Time.zone.now}}
update_metadata(case_contact, metadata)
end

def update_metadata(record, new_data)
metadata = record.metadata.deep_merge(new_data)
record.update_columns(metadata: metadata)
end
end
8 changes: 4 additions & 4 deletions app/controllers/all_casa_admins/casa_admins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create
service.create!
redirect_to all_casa_admins_casa_org_path(@casa_org), notice: "New admin created successfully"
rescue ActiveRecord::RecordInvalid
render :new
render :new, status: :unprocessable_entity
end
end

Expand All @@ -28,7 +28,7 @@ def update
@casa_admin.filter_old_emails!(@casa_admin.email)
redirect_to edit_all_casa_admins_casa_org_casa_admin_path(@casa_org), notice: notice
else
render :edit
render :edit, status: :unprocessable_entity
end
end

Expand All @@ -39,7 +39,7 @@ def activate

redirect_to edit_all_casa_admins_casa_org_casa_admin_path, notice: "Admin was activated. They have been sent an email."
else
render :edit
render :edit, status: :unprocessable_entity
end
end

Expand All @@ -50,7 +50,7 @@ def deactivate

redirect_to edit_all_casa_admins_casa_org_casa_admin_path, notice: "Admin was deactivated."
else
render :edit
render :edit, status: :unprocessable_entity
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/all_casa_admins/casa_orgs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def create
end
else
respond_to do |format|
format.html { render :new }
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @casa_org.errors.full_messages, status: :unprocessable_entity }
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/all_casa_admins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def create
end
rescue ActiveRecord::RecordInvalid
respond_to do |format|
format.html { render :new }
format.html { render :new, status: :unprocessable_entity }

format.json do
render json: @all_casa_admin.errors.full_messages, status: :unprocessable_entity
Expand All @@ -53,7 +53,7 @@ def update
end
else
respond_to do |format|
format.html { render :edit }
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @user.errors.full_messages, status: :unprocessable_entity }
end
end
Expand All @@ -78,7 +78,7 @@ def update_password
end
else
respond_to do |format|
format.html { render :edit }
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @user.errors.full_messages, status: :unprocessable_entity }
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/banners_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def create

redirect_to banners_path
rescue
render :new
render :new, status: :unprocessable_entity
end

def update
Expand All @@ -48,7 +48,7 @@ def update

redirect_to banners_path
rescue
render :edit
render :edit, status: :unprocessable_entity
end

def destroy
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/bulk_court_dates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def create
case_group_id = params[:court_date][:case_group_id]
if case_group_id.empty?
@court_date = build_court_date_with_error_message
render :new
render :new, status: :unprocessable_entity
return
end

Expand All @@ -26,7 +26,7 @@ def create

if court_date_with_error
@court_date = court_date_with_error
render :new
render :new, status: :unprocessable_entity
else
redirect_to new_bulk_court_date_path, notice: "#{court_dates.size} #{"court date".pluralize(court_dates.size)} created!"
end
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/casa_admins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def update
end
else
respond_to do |format|
format.html { render :edit }
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @casa_admin.errors.full_messages, status: :unprocessable_entity }
end
end
Expand Down Expand Up @@ -59,7 +59,7 @@ def create
end
rescue ActiveRecord::RecordInvalid
respond_to do |format|
format.html { render :new }
format.html { render :new, status: :unprocessable_entity }
format.json { render json: service.casa_admin.errors.full_messages, status: :unprocessable_entity }
end
end
Expand All @@ -81,7 +81,7 @@ def activate
end
else
respond_to do |format|
format.html { render :edit }
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @casa_admin.errors.full_messages, status: :unprocessable_entity }
end
end
Expand All @@ -100,7 +100,7 @@ def deactivate
end
else
respond_to do |format|
format.html { render :edit }
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @casa_admin.errors.full_messages, status: :unprocessable_entity }
end
end
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/casa_cases_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def create
set_contact_types
@empty_court_date = court_date_unknown?
respond_to do |format|
format.html { render :new }
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @casa_case.errors.full_messages, status: :unprocessable_entity }
end
end
Expand All @@ -79,7 +79,7 @@ def update
end
else
respond_to do |format|
format.html { render :edit }
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @casa_case.errors.full_messages, status: :unprocessable_entity }
end
end
Expand All @@ -101,7 +101,7 @@ def deactivate
end
else
respond_to do |format|
format.html { render :edit }
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @casa_case.errors.full_messages, status: :unprocessable_entity }
end
end
Expand All @@ -123,7 +123,7 @@ def reactivate
end
else
respond_to do |format|
format.html { render :edit }
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @casa_case.errors.full_messages, status: :unprocessable_entity }
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/casa_org_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def update
end
else
respond_to do |format|
format.html { render :edit }
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @casa_org.errors.full_messages, status: :unprocessable_entity }
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/case_assignments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def unassign
end
else
respond_to do |format|
format.html { render :edit }
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @case_assignment.errors.full_messages, status: :unprocessable_entity }
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/case_contacts/form_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def update
remove_unwanted_contact_types
remove_nil_draft_ids

if CaseContactUpdateService.new(@case_contact).update_attrs(case_contact_params)
if @case_contact.update(case_contact_params)
respond_to do |format|
format.html {
if step == steps.last
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/case_groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def create
if @case_group.save
redirect_to case_groups_path, notice: "Case group created!"
else
render :new
render :new, status: :unprocessable_entity
end
end

Expand All @@ -28,7 +28,7 @@ def update
if @case_group.update(case_group_params)
redirect_to case_groups_path, notice: "Case group updated!"
else
render :new
render :new, status: :unprocessable_entity
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/checklist_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def create
set_checklist_updated_date(@hearing_type)
redirect_to edit_hearing_type_path(@hearing_type), notice: "Checklist item was successfully created."
else
render :new
render :new, status: :unprocessable_entity
end
end

Expand All @@ -25,7 +25,7 @@ def update
set_checklist_updated_date(@hearing_type)
redirect_to edit_hearing_type_path(@hearing_type), notice: "Checklist item was successfully updated."
else
render :edit
render :edit, status: :unprocessable_entity
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/contact_type_groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def create
if @contact_type_group.save
redirect_to edit_casa_org_path(current_organization), notice: "Contact Type Group was successfully created."
else
render :new
render :new, status: :unprocessable_entity
end
end

Expand All @@ -27,7 +27,7 @@ def update
if @contact_type_group.update(contact_type_group_params)
redirect_to edit_casa_org_path(current_organization), notice: "Contact Type Group was successfully updated."
else
render :edit
render :edit, status: :unprocessable_entity
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/contact_types_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def create
if @contact_type.save
redirect_to edit_casa_org_path(current_organization), notice: "Contact Type was successfully created."
else
render :new
render :new, status: :unprocessable_entity
end
end

Expand All @@ -27,7 +27,7 @@ def update
if @contact_type.update(contact_type_params)
redirect_to edit_casa_org_path(current_organization), notice: "Contact Type was successfully updated."
else
render :edit
render :edit, status: :unprocessable_entity
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/court_dates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def create
if @court_date.save && @casa_case.save
redirect_to casa_case_court_date_path(@casa_case, @court_date), notice: "Court date was successfully created."
else
render :new
render :new, status: :unprocessable_entity
end
end

Expand All @@ -47,7 +47,7 @@ def update
if @court_date.update(court_date_params(@casa_case))
redirect_to casa_case_court_date_path(@casa_case, @court_date), notice: "Court date was successfully updated."
else
render :edit
render :edit, status: :unprocessable_entity
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/fund_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def create
FundRequestMailer.send_request(nil, @fund_request).deliver
redirect_to casa_case_path(@casa_case), notice: "Fund Request was sent for case #{@casa_case.case_number}"
else
render :new
render :new, status: :unprocessable_entity
end
end

Expand Down
Loading

0 comments on commit b999f50

Please sign in to comment.