1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 17:02:47 +00:00
* fix txt view participants

* fix detail panel bug
This commit is contained in:
Michael An
2019-08-07 09:18:54 +08:00
committed by Daniel Pan
parent b5f26f98b1
commit 213559ec9c
2 changed files with 10 additions and 7 deletions

View File

@@ -50,7 +50,9 @@ class DirentDetail extends React.Component {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
let { dirent, path, repoID } = nextProps; let { dirent, path, repoID } = nextProps;
this.loadDirentInfo(dirent, path, repoID); if (this.props.dirent !== nextProps.dirent) {
this.loadDirentInfo(dirent, path, repoID);
}
if (this.props.direntDetailPanelTab) { if (this.props.direntDetailPanelTab) {
this.tabItemClick(this.props.direntDetailPanelTab); this.tabItemClick(this.props.direntDetailPanelTab);
} }

View File

@@ -89,8 +89,8 @@ class ViewFileText extends React.Component {
} }
addParticipant = () => { addParticipant = () => {
seafileAPI.addFileParticipant(repoID, filePath, username).then((res) => { seafileAPI.addFileParticipants(repoID, filePath, [username]).then((res) => {
if (res.status === 201) { if (res.status === 200) {
this.isParticipant = true; this.isParticipant = true;
this.getParticipants(); this.getParticipants();
} }
@@ -100,11 +100,12 @@ class ViewFileText extends React.Component {
getParticipants = () => { getParticipants = () => {
seafileAPI.listFileParticipants(repoID, filePath).then((res) => { seafileAPI.listFileParticipants(repoID, filePath).then((res) => {
const participants = res.data.participant_list; const participants = res.data.participant_list;
if (participants.length === 0) return;
this.setState({ participants: participants }); this.setState({ participants: participants });
this.isParticipant = participants.every((participant) => { if (participants.length > 0) {
return participant.email == username; this.isParticipant = participants.every((participant) => {
}); return participant.email == username;
});
}
}); });
} }