Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File upload failure checking #3332

Merged
merged 2 commits into from
Jun 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Log from '../Log';
import {isReportMessageAttachment, sortReportsByLastVisited} from '../reportUtils';
import Timers from '../Timers';
import {dangerouslyGetReportActionsMaxSequenceNumber, isReportMissingActions} from './ReportActions';
import Growl from '../Growl';

let currentUserEmail;
let currentUserAccountID;
Expand Down Expand Up @@ -1040,7 +1041,17 @@ function addAction(reportID, text, file) {
// the same way report actions can.
persist: !isAttachment,
})
.then(({reportAction}) => updateReportWithNewAction(reportID, reportAction));
.then((response) => {
if (response.jsonCode === 408) {
Growl.show('Upload Failed. File is not supported.', CONST.GROWL.ERROR);
parasharrajat marked this conversation as resolved.
Show resolved Hide resolved
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
[optimisticReportActionID]: null,
});
console.error(response.message);
return;
}
updateReportWithNewAction(reportID, response.reportAction);
});
}

/**
Expand Down