fix: tweet not saved correctly when using share button on iOS

This commit is contained in:
Hongbo Wu 2023-06-27 16:47:36 +08:00
parent 6ef970a6e4
commit f372636d6e

View file

@ -117,7 +117,24 @@ export const savePage = async (
? await createLabels(ctx, input.labels)
: undefined
if (existingPage) {
// always parse in backend if the url is in the force puppeteer list
if (shouldParseInBackend(input)) {
try {
await createPageSaveRequest({
userId: saver.userId,
url: articleToSave.url,
pubsub: ctx.pubsub,
articleSavingRequestId: input.clientRequestId,
archivedAt: articleToSave.archivedAt,
labels: articleToSave.labels,
})
} catch (e) {
return {
errorCodes: [SaveErrorCode.Unknown],
message: 'Failed to create page save request',
}
}
} else if (existingPage) {
pageId = existingPage.id
slug = existingPage.slug
if (
@ -138,22 +155,6 @@ export const savePage = async (
message: 'Failed to update existing page',
}
}
} else if (shouldParseInBackend(input)) {
try {
await createPageSaveRequest({
userId: saver.userId,
url: articleToSave.url,
pubsub: ctx.pubsub,
articleSavingRequestId: input.clientRequestId,
archivedAt: articleToSave.archivedAt,
labels: articleToSave.labels,
})
} catch (e) {
return {
errorCodes: [SaveErrorCode.Unknown],
message: 'Failed to create page save request',
}
}
} else {
const newPageId = await createPage(articleToSave, ctx)
if (!newPageId) {