Write submission records
This commit is contained in:
@@ -18,6 +18,7 @@ import {isNetworkError} from '#/lib/strings/errors'
|
||||
import {shortenLinks, stripInvalidMentions} from '#/lib/strings/rich-text-manip'
|
||||
import {logger} from '#/logger'
|
||||
import {compressImage} from '#/state/gallery'
|
||||
import {writeFeedSubmissionRecords} from '#/state/queries/feedgens'
|
||||
import {writePostgateRecord} from '#/state/queries/postgate'
|
||||
import {
|
||||
fetchResolveGifQuery,
|
||||
@@ -173,6 +174,26 @@ export async function post(
|
||||
}
|
||||
}
|
||||
|
||||
if (draft.feeds?.length) {
|
||||
try {
|
||||
await writeFeedSubmissionRecords({
|
||||
agent,
|
||||
records: draft.feeds.map(feedUri => ({
|
||||
feedUri,
|
||||
postUri: res.uri,
|
||||
})),
|
||||
})
|
||||
} catch (e: any) {
|
||||
logger.error(`Failed to create submission records`, {
|
||||
context: 'composer',
|
||||
safeMessage: e.message,
|
||||
})
|
||||
throw new Error(
|
||||
t`Failed to write feed submission records. Your post was created, but it was not submitted to any feeds.`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user