Stop the user from posting before the link card finishes loading (#2328)

* Stop the user from posting before the link card finishes loading

* Add localization of error messages
This commit is contained in:
Paul Frazee 2023-12-27 08:47:26 -08:00 committed by GitHub
parent e27ffc850a
commit 3b240db0c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 96 additions and 44 deletions

View file

@ -207,7 +207,11 @@ export const ComposePost = observer(function ComposePost({
setError('')
if (richtext.text.trim().length === 0 && gallery.isEmpty && !extLink) {
setError('Did you want to say anything?')
setError(_(msg`Did you want to say anything?`))
return
}
if (extLink?.isLoading) {
setError(_(msg`Please wait for your link card to finish loading`))
return
}
@ -438,7 +442,7 @@ export const ComposePost = observer(function ComposePost({
accessibilityLabel={_(msg`Add link card`)}
accessibilityHint={`Creates a card with a thumbnail. The card links to ${url}`}>
<Text style={pal.text}>
<Trans>Add link card:</Trans>
<Trans>Add link card:</Trans>{' '}
<Text style={[pal.link, s.ml5]}>{toShortUrl(url)}</Text>
</Text>
</TouchableOpacity>