1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +00:00

freeze document

This commit is contained in:
lian
2023-11-14 16:06:45 +08:00
committed by 杨顺强
parent eefbc643c6
commit 9d52a45474
7 changed files with 35 additions and 8 deletions

View File

@@ -271,6 +271,9 @@ class DirentListItem extends React.Component {
case 'Lock':
this.onLockItem();
break;
case 'Freeze Document':
this.onFreezeDocument();
break;
case 'Convert to Markdown':
this.onItemConvert(event, 'markdown');
break;
@@ -369,6 +372,20 @@ class DirentListItem extends React.Component {
});
};
onFreezeDocument = () => {
let repoID = this.props.repoID;
let filePath = this.getDirentPath(this.props.dirent);
seafileAPI.lockfile(repoID, filePath, -1).then(() => {
this.props.updateDirent(this.props.dirent, 'is_locked', true);
this.props.updateDirent(this.props.dirent, 'locked_by_me', true);
let lockName = username.split('@');
this.props.updateDirent(this.props.dirent, 'lock_owner_name', lockName[0]);
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
toaster.danger(errMessage);
});
};
onUnlockItem = () => {
let repoID = this.props.repoID;
let filePath = this.getDirentPath(this.props.dirent);