Nicer error message for disabled quotes (#5644)
This commit is contained in:
@@ -64,7 +64,7 @@ export type ResolvedLink =
|
|||||||
| ResolvedPostRecord
|
| ResolvedPostRecord
|
||||||
| ResolvedOtherRecord
|
| ResolvedOtherRecord
|
||||||
|
|
||||||
class EmbeddingDisabledError extends Error {
|
export class EmbeddingDisabledError extends Error {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('Embedding is disabled for this record')
|
super('Embedding is disabled for this record')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import * as apilib from '#/lib/api/index'
|
import * as apilib from '#/lib/api/index'
|
||||||
|
import {EmbeddingDisabledError} from '#/lib/api/resolve'
|
||||||
import {until} from '#/lib/async/until'
|
import {until} from '#/lib/async/until'
|
||||||
import {MAX_GRAPHEME_LENGTH} from '#/lib/constants'
|
import {MAX_GRAPHEME_LENGTH} from '#/lib/constants'
|
||||||
import {useAnimatedScrollHandler} from '#/lib/hooks/useAnimatedScrollHandler_FIXED'
|
import {useAnimatedScrollHandler} from '#/lib/hooks/useAnimatedScrollHandler_FIXED'
|
||||||
@@ -420,6 +421,8 @@ export const ComposePost = ({
|
|||||||
err = _(
|
err = _(
|
||||||
msg`We're sorry! The post you are replying to has been deleted.`,
|
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)
|
setError(err)
|
||||||
setIsProcessing(false)
|
setIsProcessing(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user