1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 10:58:33 +00:00

Add comment and participant (#3882)

* update handle error

* comment and add participant

* update nextProps
This commit is contained in:
Michael An
2019-07-22 16:34:25 +08:00
committed by Daniel Pan
parent 2598cd433e
commit fc56ae5cec
3 changed files with 67 additions and 17 deletions

View File

@@ -5,6 +5,7 @@ import { gettext } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import UserSelect from '../user-select';
import toaster from '../toast';
import { Utils } from '../../utils/utils';
import '../../css/participants-list.css';
const fileParticipantListItemPropTypes = {
@@ -75,8 +76,9 @@ class FileParticipantDialog extends Component {
const { repoID, filePath } = this.props;
seafileAPI.deleteFileParticipant(repoID, filePath, email).then((res) => {
this.props.onParticipantsChange(repoID, filePath);
}).catch((error) => {
this.handleError(error);
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
toaster.danger(errMessage);
});
this.refs.userSelect.clearSelect();
};
@@ -90,22 +92,15 @@ class FileParticipantDialog extends Component {
for (let i = 0; i < selectedOption.length; i++) {
seafileAPI.addFileParticipant(repoID, filePath, selectedOption[i].email).then((res) => {
this.props.onParticipantsChange(repoID, filePath);
}).catch((error) => {
this.handleError(error);
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
toaster.danger(errMessage);
});
}
this.setState({ selectedOption: null });
this.refs.userSelect.clearSelect();
};
handleError = (e) => {
if (e.response) {
toaster.danger(e.response.data.error_msg || e.response.data.detail || gettext('Error'), {duration: 3});
} else {
toaster.danger(gettext('Please check the network.'), {duration: 3});
}
};
render() {
const renderParticipantList = this.props.fileParticipantList.map((participant, index) => {
return (