Nicer error message for disabled quotes (#5644)

This commit is contained in:
dan
2024-10-08 14:46:15 +09:00
committed by GitHub
parent db76452822
commit efcf8a6ae5
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ export type ResolvedLink =
| ResolvedPostRecord
| ResolvedOtherRecord
class EmbeddingDisabledError extends Error {
export class EmbeddingDisabledError extends Error {
constructor() {
super('Embedding is disabled for this record')
}
+3
View File
@@ -48,6 +48,7 @@ import {useLingui} from '@lingui/react'
import {useQueryClient} from '@tanstack/react-query'
import * as apilib from '#/lib/api/index'
import {EmbeddingDisabledError} from '#/lib/api/resolve'
import {until} from '#/lib/async/until'
import {MAX_GRAPHEME_LENGTH} from '#/lib/constants'
import {useAnimatedScrollHandler} from '#/lib/hooks/useAnimatedScrollHandler_FIXED'
@@ -420,6 +421,8 @@ export const ComposePost = ({
err = _(
msg`We're sorry! The post you are replying to has been deleted.`,
)
} else if (e instanceof EmbeddingDisabledError) {
err = _(msg`This post's author has disabled quote posts.`)
}
setError(err)
setIsProcessing(false)