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

fix: incorrect followup urls #5863

Merged
Merged
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
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
Loading