1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 21:30:39 +00:00

add participants in file comment and detail panel (#3880)

This commit is contained in:
Michael An
2019-07-20 09:51:19 +08:00
committed by Daniel Pan
parent 2ab3b45bf6
commit 2598cd433e
5 changed files with 39 additions and 4 deletions

View File

@@ -26,6 +26,7 @@ class CommentPanel extends React.Component {
this.state = {
commentsList: [],
showResolvedComment: true,
participants: null,
};
}
@@ -92,8 +93,27 @@ class CommentPanel extends React.Component {
});
}
onParticipantsChange = () => {
if (this.props.onParticipantsChange) {
this.props.onParticipantsChange();
} else {
this.getParticipants();
}
}
getParticipants = () => {
if (this.props.participants) {
this.setState({ participants: this.props.participants });
} else {
seafileAPI.listFileParticipants(repoID, filePath).then((res) => {
this.setState({ participants: res.data.participant_list });
});
}
}
componentDidMount() {
this.listComments();
this.getParticipants();
}
componentWillReceiveProps(nextProps) {
@@ -103,7 +123,7 @@ class CommentPanel extends React.Component {
}
render() {
const { participants } = this.props;
const { participants } = this.state;
return (
<div className="seafile-comment">
<div className="seafile-comment-title">
@@ -148,7 +168,7 @@ class CommentPanel extends React.Component {
<div className="seafile-comment-footer">
{participants &&
<ParticipantsList
onParticipantsChange={this.props.onParticipantsChange}
onParticipantsChange={this.onParticipantsChange}
participants={participants}
repoID={repoID}
filePath={filePath}