mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 14:12:10 +08:00
FEATURE: Add Filter for Webhook Events by Status (#27332)
* FEATURE: Add Filter for Webhook Events by Status * Fixing multiple issues * Lint * Fixing multiple issues * Change the range of the status for webhook events
This commit is contained in:
@ -87,14 +87,19 @@ class Admin::WebHooksController < Admin::AdminController
|
||||
def list_events
|
||||
limit = 50
|
||||
offset = params[:offset].to_i
|
||||
events = @web_hook.web_hook_events
|
||||
if params[:status] == "successful"
|
||||
events = events.successful
|
||||
elsif params[:status] == "failed"
|
||||
events = events.failed
|
||||
end
|
||||
|
||||
total = events.count
|
||||
events = events.limit(limit).offset(offset)
|
||||
|
||||
json = {
|
||||
web_hook_events:
|
||||
serialize_data(
|
||||
@web_hook.web_hook_events.limit(limit).offset(offset),
|
||||
AdminWebHookEventSerializer,
|
||||
),
|
||||
total_rows_web_hook_events: @web_hook.web_hook_events.count,
|
||||
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),
|
||||
extras: {
|
||||
|
Reference in New Issue
Block a user