Skip to content

Commit

Permalink
compose: Put what's most important at the beginning of a toast
Browse files Browse the repository at this point in the history
The "failed" part is really important, and we can't have it get cut
off [1] just because a file name is very long.

[1] https://developer.android.com/about/versions/12/behavior-changes-12#toast-redesign

Fixes: #5171
  • Loading branch information
chrisbobbe authored and gnprice committed Dec 22, 2021
1 parent 3a52fc3 commit 0760de7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/compose/ComposeBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,11 @@ class ComposeBoxInner extends PureComponent<Props, State> {
try {
response = await api.uploadFile(auth, attachments[i].uri, fileName);
} catch (e) {
showToast(_('Uploading {fileName} failed.', { fileName }));
showToast(_('Failed to upload file: {fileName}', { fileName }));
this.setMessageInputValue(
this.state.message.replace(
placeholder,
`[${_('Uploading {fileName} failed.', { fileName })}]()`,
`[${_('Failed to upload file: {fileName}', { fileName })}]()`,
),
);
continue;
Expand Down
2 changes: 1 addition & 1 deletion static/translations/messages_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
"This will make the mobile app on this device forget {email} on {realmUrl}.": "This will make the mobile app on this device forget {email} on {realmUrl}.",
"Oops! Something went wrong.": "Oops! Something went wrong.",
"Uploading {fileName}...": "Uploading {fileName}...",
"Uploading {fileName} failed.": "Uploading {fileName} failed.",
"Failed to upload file: {fileName}": "Failed to upload file: {fileName}",
"Attachment": "Attachment",
"Attachment {num}": "Attachment {num}",
"Failed to mark topic as read": "Failed to mark topic as read",
Expand Down

0 comments on commit 0760de7

Please sign in to comment.