FIX: fix Webhook events filter 'loadMore' not taking params (#27403)

After working on the Webhook events filter by Status, I noticed that the 'Delivered' and 'Failed' options do not take the status param when loading more than fifty Webhook events. It causes to load all Webhook events regardless of its status after the first load.

This PR is adding webhook events status for the filter to the param when loading more than fifty Webhook events.
This commit is contained in:
Guhyoun Nam
2024-06-11 20:17:47 -05:00
committed by GitHub
parent 0b8e6e7d1d
commit 30f369fffe
2 changed files with 16 additions and 3 deletions

View File

@ -88,9 +88,10 @@ class Admin::WebHooksController < Admin::AdminController
limit = 50
offset = params[:offset].to_i
events = @web_hook.web_hook_events
if params[:status] == "successful"
status = params[:status]
if status == "successful"
events = events.successful
elsif params[:status] == "failed"
elsif status == "failed"
events = events.failed
end
@ -101,7 +102,12 @@ class Admin::WebHooksController < Admin::AdminController
web_hook_events: serialize_data(events, AdminWebHookEventSerializer),
total_rows_web_hook_events: total,
load_more_web_hook_events:
web_hook_events_admin_api_index_path(limit: limit, offset: offset + limit, format: :json),
web_hook_events_admin_api_index_path(
limit: limit,
offset: offset + limit,
status: status,
format: :json,
),
extras: {
web_hook_id: @web_hook.id,
},