feat: Add a documentation layout design for public help center portal (#14403)
https://github.com/user-attachments/assets/fc4d15f9-2b54-4627-940f-94772ec739b1 --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
This commit is contained in:
co-authored by
Muhsin Keloth
Sivin Varghese
parent
e05008e0a4
commit
64585faff0
@@ -140,6 +140,38 @@ RSpec.describe 'Public Articles API', type: :request do
|
||||
get "/hc/#{portal.slug}/articles/#{article_in_locale.slug}"
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
it 'resolves the locale from the article itself for an uncategorized article' do
|
||||
uncategorized_article = create(:article, category: nil, locale: 'es', portal: portal,
|
||||
account_id: account.id, author_id: agent.id)
|
||||
get "/hc/#{portal.slug}/articles/#{uncategorized_article.slug}"
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include('lang="es"')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET /public/api/v1/portals/:slug/articles/:slug.md (markdown)' do
|
||||
it 'serves the raw article markdown for a published article' do
|
||||
get "/hc/#{portal.slug}/articles/#{article.slug}.md"
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.headers['Content-Type']).to include('text/markdown')
|
||||
expect(response.body).to eq(article.content)
|
||||
end
|
||||
|
||||
it 'returns 404 for a draft article' do
|
||||
draft_article = create(:article, category: category, status: :draft, portal: portal, account_id: account.id, author_id: agent.id)
|
||||
|
||||
get "/hc/#{portal.slug}/articles/#{draft_article.slug}.md"
|
||||
|
||||
expect(response).to have_http_status(:not_found)
|
||||
end
|
||||
|
||||
it 'returns 404 if the article does not exist' do
|
||||
get "/hc/#{portal.slug}/articles/non-existent-article.md"
|
||||
|
||||
expect(response).to have_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET /public/api/v1/portals/:slug/articles/:slug.png (tracking pixel)' do
|
||||
|
||||
@@ -11,12 +11,13 @@ RSpec.describe 'Public Categories API', type: :request do
|
||||
end
|
||||
|
||||
describe 'GET /public/api/v1/portals/:portal_slug/categories' do
|
||||
it 'Fetch all categories in the portal' do
|
||||
it 'redirects to the locale home page' do
|
||||
category = portal.categories.first
|
||||
|
||||
get "/hc/#{portal.slug}/#{category.locale}/categories"
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response).to have_http_status(:moved_permanently)
|
||||
expect(response).to redirect_to("/hc/#{portal.slug}/#{category.locale}")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user