mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 07:55:36 +00:00
freeze document
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user