Skip to content

Commit

Permalink
fix: incorrect followup urls (#5863)
Browse files Browse the repository at this point in the history
The mark_as_read action was not redirecting to the case contact that it
was marking as read.
  • Loading branch information
elasticspoon committed Jun 26, 2024
1 parent b37476e commit 0e0dd8e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 20 deletions.
1 change: 0 additions & 1 deletion app/controllers/case_contacts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def new

def edit
authorize @case_contact
current_user.notifications.unread.where(id: params[:notification_id]).mark_as_read
redirect_to case_contact_form_path(CaseContact::FORM_STEPS.first, case_contact_id: @case_contact.id)
end

Expand Down
2 changes: 1 addition & 1 deletion app/notifications/followup_notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def message
end

def url
edit_case_contact_path(params[:followup].id, notification_id: id)
edit_case_contact_path(params[:followup].case_contact_id)
end

private
Expand Down
17 changes: 0 additions & 17 deletions spec/requests/case_contacts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,6 @@
end

it { is_expected.to have_http_status(:redirect) }

describe "unread notification" do
let(:followup) { create(:followup, case_contact: case_contact, creator: admin) }

subject(:request) do
get edit_case_contact_url(case_contact, notification_id: admin.notifications.first.id)

response
end

before { FollowupResolvedNotifier.with(followup: followup, created_by: admin).deliver(followup.creator) }

it "is marked as read" do
request
expect(admin.notifications.unread).to eq([])
end
end
end

describe "DELETE /destroy" do
Expand Down
4 changes: 3 additions & 1 deletion spec/requests/notifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@
it "redirects to the notification event URL" do
post mark_as_read_notification_path(notification)

expect(response).to redirect_to(notification.event.url)
case_contact_url = edit_case_contact_path(CaseContact.last)

expect(response).to redirect_to(case_contact_url)
end
end

Expand Down

0 comments on commit 0e0dd8e

Please sign in to comment.