このコミットが含まれているのは:
@@ -22,8 +22,21 @@ export const isManualSkipRow = (row: PostImportRow): boolean =>
|
||||
const hasSkipReason = (row: PostImportRow): boolean =>
|
||||
row.skipReason != null
|
||||
|
||||
export const compactMessageRecord = (
|
||||
messages: Record<string, string[]>,
|
||||
): Record<string, string[]> =>
|
||||
Object.fromEntries (
|
||||
Object.entries (messages).filter (([, values]) => values.length > 0))
|
||||
|
||||
|
||||
export const hasErrorMessages = (
|
||||
messages: Record<string, string[]>,
|
||||
): boolean =>
|
||||
Object.values (messages).some (values => values.length > 0)
|
||||
|
||||
|
||||
const hasValidationErrors = (row: PostImportRow): boolean =>
|
||||
Object.keys (row.validationErrors ?? { }).length > 0
|
||||
hasErrorMessages (row.validationErrors ?? { })
|
||||
|
||||
const isRecoverableRow = (row: PostImportRow): boolean =>
|
||||
row.recoverable === true
|
||||
@@ -79,9 +92,9 @@ const thumbnailWarnings = (row: PostImportRow): string[] => {
|
||||
|
||||
export const applyThumbnailWarning = (row: PostImportRow): PostImportRow => ({
|
||||
...row,
|
||||
fieldWarnings: {
|
||||
fieldWarnings: compactMessageRecord ({
|
||||
...row.fieldWarnings,
|
||||
thumbnailBase: thumbnailWarnings (row) } })
|
||||
thumbnailBase: thumbnailWarnings (row) }) })
|
||||
|
||||
|
||||
export const applyThumbnailWarnings = (rows: PostImportRow[]): PostImportRow[] =>
|
||||
@@ -90,7 +103,7 @@ export const applyThumbnailWarnings = (rows: PostImportRow[]): PostImportRow[] =
|
||||
|
||||
export const processableImportRows = (rows: PostImportRow[]): PostImportRow[] =>
|
||||
validatableImportRows (rows).filter (row => {
|
||||
if (row.metadataUrl == null)
|
||||
if (row.status === 'pending')
|
||||
return false
|
||||
if (row.importStatus === 'created')
|
||||
return false
|
||||
@@ -290,7 +303,7 @@ export const mergeValidatedImportRows = (
|
||||
return previous
|
||||
|
||||
const fieldWarnings =
|
||||
Object.keys (row.fieldWarnings).length > 0 || row.metadataUrl !== previous.metadataUrl
|
||||
hasErrorMessages (row.fieldWarnings) || row.metadataUrl !== previous.metadataUrl
|
||||
? { ...row.fieldWarnings }
|
||||
: { ...previous.fieldWarnings }
|
||||
for (const [field, origin] of Object.entries (row.provenance))
|
||||
@@ -345,9 +358,10 @@ export const mergeImportResults = (
|
||||
createdPostId: result.post.id,
|
||||
existingPostId: undefined,
|
||||
existingPost: undefined,
|
||||
fieldWarnings: result.fieldWarnings ?? row.fieldWarnings,
|
||||
fieldWarnings: compactMessageRecord (
|
||||
result.fieldWarnings ?? row.fieldWarnings),
|
||||
baseWarnings: result.baseWarnings ?? row.baseWarnings,
|
||||
importErrors: result.errors }
|
||||
importErrors: compactMessageRecord (result.errors ?? { }) }
|
||||
case 'skipped':
|
||||
return {
|
||||
...row,
|
||||
@@ -357,9 +371,10 @@ export const mergeImportResults = (
|
||||
createdPostId: undefined,
|
||||
existingPostId: result.existingPostId,
|
||||
existingPost: result.existingPost ?? row.existingPost,
|
||||
fieldWarnings: result.fieldWarnings ?? row.fieldWarnings,
|
||||
fieldWarnings: compactMessageRecord (
|
||||
result.fieldWarnings ?? row.fieldWarnings),
|
||||
baseWarnings: result.baseWarnings ?? row.baseWarnings,
|
||||
importErrors: result.errors }
|
||||
importErrors: compactMessageRecord (result.errors ?? { }) }
|
||||
case 'failed':
|
||||
return {
|
||||
...row,
|
||||
@@ -369,9 +384,10 @@ export const mergeImportResults = (
|
||||
createdPostId: undefined,
|
||||
existingPostId: undefined,
|
||||
existingPost: undefined,
|
||||
fieldWarnings: result.fieldWarnings ?? row.fieldWarnings,
|
||||
fieldWarnings: compactMessageRecord (
|
||||
result.fieldWarnings ?? row.fieldWarnings),
|
||||
baseWarnings: result.baseWarnings ?? row.baseWarnings,
|
||||
importErrors: result.errors }
|
||||
importErrors: compactMessageRecord (result.errors ?? { }) }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする