fix: increase audit log page size (#14582)

Audit logs now return up to 25 records per page instead of 15. This
reduces page turns for admins and API consumers while keeping the page
size server-defined.

Fixes
https://linear.app/chatwoot/issue/CW-7172/allow-an-option-to-fetch-more-audit-logs
This commit is contained in:
Vishnu Narayanan 2026-05-28 12:35:44 +05:30 committed by GitHub
parent 68e358d732
commit 6c8741b314
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 8 deletions

View File

@ -7,7 +7,7 @@ const state = {
records: [],
meta: {
currentPage: 1,
perPage: 15,
perPage: 25,
totalEntries: 0,
},
uiFlags: {

View File

@ -2,7 +2,7 @@ class Api::V1::Accounts::AuditLogsController < Api::V1::Accounts::EnterpriseAcco
before_action :check_admin_authorization?
before_action :fetch_audit
RESULTS_PER_PAGE = 15
RESULTS_PER_PAGE = 25
def show
@audit_logs = @audit_logs.page(params[:page]).per(RESULTS_PER_PAGE)

View File

@ -51,10 +51,13 @@ RSpec.describe 'Enterprise Audit API', type: :request do
expect(json_response['audit_logs'][1]['action']).to eql('create')
expect(json_response['audit_logs'][1]['audited_changes']['name']).to eql(inbox.name)
expect(json_response['audit_logs'][1]['associated_id']).to eql(account.id)
expect(json_response['current_page']).to be(1)
# contains audit log for account user as well
# contains audit logs for account update(enable audit logs)
expect(json_response['total_entries']).to be(3)
expect(json_response.slice('current_page', 'per_page', 'total_entries')).to eql(
'current_page' => 1,
'per_page' => 25,
'total_entries' => 3
)
end
end
end

View File

@ -24,7 +24,7 @@ responses:
per_page:
type: integer
description: Number of items per page
example: 15
example: 25
total_entries:
type: integer
description: Total number of audit log entries
@ -49,4 +49,4 @@ responses:
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
$ref: '#/components/schemas/bad_request_error'

View File

@ -1649,7 +1649,7 @@
"per_page": {
"type": "integer",
"description": "Number of items per page",
"example": 15
"example": 25
},
"total_entries": {
"type": "integer",

View File

@ -192,7 +192,7 @@
"per_page": {
"type": "integer",
"description": "Number of items per page",
"example": 15
"example": 25
},
"total_entries": {
"type": "integer",