Skip to content

Commit

Permalink
Nicer error message for disabled quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Oct 8, 2024
1 parent db76452 commit 046f5ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/api/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand Down
3 changes: 3 additions & 0 deletions src/view/com/composer/Composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 046f5ce

Please sign in to comment.