feat(help-center): enable drag-and-drop category reordering (#13706)

This commit is contained in:
Sojan Jose
2026-03-04 23:23:38 -08:00
committed by GitHub
parent 3abe32a2c7
commit 42a244369d
33 changed files with 708 additions and 47 deletions

View File

@@ -100,4 +100,18 @@ RSpec.describe 'Enterprise Articles API', type: :request do
end
end
end
describe 'POST /api/v1/accounts/:account_id/portals/:portal_slug/articles/reorder' do
context 'when it is an authenticated user' do
it 'returns success for agents with knowledge_base_manage permission' do
post "/api/v1/accounts/#{account.id}/portals/#{portal.slug}/articles/reorder",
params: { positions_hash: { article.id => 20 } },
headers: agent_with_role.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
expect(article.reload.position).to eq(20)
end
end
end
end

View File

@@ -108,4 +108,27 @@ RSpec.describe 'Enterprise Categories API', type: :request do
end
end
end
describe 'POST /api/v1/accounts/:account_id/portals/:portal_slug/categories/reorder' do
context 'when it is an authenticated user' do
it 'returns success for agents with knowledge_base_manage permission' do
post "/api/v1/accounts/#{account.id}/portals/#{portal.slug}/categories/reorder",
params: { positions_hash: { category.id => 20 } },
headers: agent_with_role.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
expect(category.reload.position).to eq(20)
end
it 'returns not found for invalid portal slug' do
post "/api/v1/accounts/#{account.id}/portals/invalid-portal-slug/categories/reorder",
params: { positions_hash: { category.id => 20 } },
headers: agent_with_role.create_new_auth_token,
as: :json
expect(response).to have_http_status(:not_found)
end
end
end
end