fix: technical debts left by the Sites, Authors and SEO slices, plus backend support for the new Sites and Authors pagination
This commit is contained in:
1 parent
9f4ce426a8
commit
daf3594316
86 files changed
+4223
-1485
No files matched your search
+16
-10
@@ -919,15 +919,6 @@ function articleEnvelopeFor(
|
||||
url: URL,
|
||||
needsAttention = boardNeedsAttentionCount,
|
||||
) {
|
||||
if (url.searchParams.get('seo') === 'suggestions' && !url.searchParams.has('format')) {
|
||||
return {
|
||||
items: [],
|
||||
total: needsAttention,
|
||||
page: 1,
|
||||
size: 5,
|
||||
counts: { all: 0, online: 0, draft: 0 },
|
||||
}
|
||||
}
|
||||
const page = Number(url.searchParams.get('page') ?? 1)
|
||||
const size = Number(url.searchParams.get('size') ?? 25)
|
||||
const q = url.searchParams.get('q') ?? ''
|
||||
@@ -944,7 +935,12 @@ function articleEnvelopeFor(
|
||||
total: matching.length,
|
||||
page,
|
||||
size,
|
||||
counts: { all: all.length, online, draft: all.length - online },
|
||||
counts: {
|
||||
all: all.length,
|
||||
online,
|
||||
draft: all.length - online,
|
||||
suggestions: needsAttention,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5682,8 +5678,18 @@ interface SeoOptions {
|
||||
library?: boolean
|
||||
}
|
||||
|
||||
function seoMediaById(): Record<string, ApiMock> {
|
||||
return Object.fromEntries(
|
||||
avatarPickerList().items.map((item) => [
|
||||
`GET /v1/media/${(item as { id: number }).id}`,
|
||||
{ status: 200, body: item },
|
||||
]),
|
||||
)
|
||||
}
|
||||
|
||||
function seoApi(options: SeoOptions = {}): Record<string, ApiMock> {
|
||||
return editorApi({
|
||||
...seoMediaById(),
|
||||
'GET /v1/article/12': {
|
||||
status: 200,
|
||||
body: seoArticle(options.article, options.body),
|
||||
|
||||
Reference in new issue
Block a user