Updated content importer to fail only on errors

no refs.

- the content importer sent an "Import failed" email even if only warnings occured during import
This commit is contained in:
Peter Zimon 2022-11-18 19:07:03 +01:00
parent a3376fe502
commit 3cf3e5b5c4
2 changed files with 3 additions and 3 deletions

View File

@ -122,10 +122,10 @@ module.exports = ({result, siteUrl, postsUrl, emailRecipient}) => `
</tr>
<tr>
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; vertical-align: top;">
<p class="title" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 21px; color: #3A464C; font-weight: normal; line-height: 25px; margin-bottom: 30px; margin-top: 50px; font-weight: 600; color: #15212A;">${result.data.problems.length ? 'Import unsuccessful' : 'Your content import has finished successfully'}</p>
<p class="title" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 21px; color: #3A464C; font-weight: normal; line-height: 25px; margin-bottom: 30px; margin-top: 50px; font-weight: 600; color: #15212A;">${result?.data?.errors ? 'Import unsuccessful' : 'Your content import has finished successfully'}</p>
</td>
</tr>
${result.data.problems.length ? `
${result?.data?.errors ? `
<tr>
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; vertical-align: top; padding-bottom: 16px;">One or more error occured while importing your content. Please contact support or report on the <a href="https://forum.ghost.org/">Ghost Community Forum</a>.</td>
</tr>

View File

@ -451,7 +451,7 @@ class ImportManager {
});
await ghostMailer.send({
to: importOptions.user.email,
subject: importResult.data.problems.length
subject: importResult.data?.errors
? 'Your content import was unsuccessful'
: 'Your content import has finished',
html: email