Skip to content

Commit

Permalink
[dir view] markdown/sdoc conversion: only display 1 toast for one tim…
Browse files Browse the repository at this point in the history
…e(don't display 2 toasts at the same time) (#5906)
  • Loading branch information
llj authored Jan 19, 2024
1 parent 95b32dc commit 5beb516
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/src/pages/lib-content-view/lib-content-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ class LibContentView extends React.Component {
onConvertItem = (dirent, dstType) => {
let path = Utils.joinPath(this.state.path, dirent.name);
let repoID = this.props.repoID;
toaster.notifyInProgress(gettext('Converting, please wait...'));
toaster.notifyInProgress(gettext('Converting, please wait...'), {'id': 'conversion'});
seafileAPI.convertFile(repoID, path, dstType).then((res) => {
let newFileName = res.data.obj_name;
let parentDir = res.data.parent_dir;
Expand All @@ -1274,15 +1274,15 @@ class LibContentView extends React.Component {

this.addDirent(newFileName, 'file', res.data.size);
let message = gettext('Successfully converted the file.');
toaster.success(message);
toaster.success(message, {'id': 'conversion'});

}).catch((error) => {
let errMessage = Utils.getErrorMsg(error);
if (errMessage === gettext('Error')) {
let name = Utils.getFileName(path);
errMessage = gettext('Failed to convert {name}.').replace('{name}', name);
}
toaster.danger(errMessage);
toaster.danger(errMessage, {'id': 'conversion'});
});

};
Expand Down

0 comments on commit 5beb516

Please sign in to comment.