mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-24 21:07:17 +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);
|
||||
|
@@ -21,6 +21,7 @@ const TextTranslation = {
|
||||
'DETAILS' : {key : 'Details', value : gettext('Details')},
|
||||
'OPEN_VIA_CLIENT' : {key : 'Open via Client', value : gettext('Open via Client')},
|
||||
'LOCK' : {key : 'Lock', value : gettext('Lock')},
|
||||
'FREEZE_DOCUMENT' : {key : 'Freeze Document', value : gettext('Freeze Document')},
|
||||
'UNLOCK' : {key : 'Unlock', value : gettext('Unlock')},
|
||||
'CONVERT_TO_MARKDOWN' : {key : 'Convert to Markdown', value : gettext('Convert to Markdown')},
|
||||
'CONVERT_TO_SDOC' : {key : 'Convert to sdoc', value : gettext('Convert to sdoc')},
|
||||
|
@@ -527,7 +527,7 @@ export const Utils = {
|
||||
|
||||
getFileOperationList: function(isRepoOwner, currentRepoInfo, dirent, isContextmenu) {
|
||||
let list = [];
|
||||
const { SHARE, DOWNLOAD, DELETE, RENAME, MOVE, COPY, TAGS, UNLOCK, LOCK,
|
||||
const { SHARE, DOWNLOAD, DELETE, RENAME, MOVE, COPY, TAGS, UNLOCK, LOCK, FREEZE_DOCUMENT,
|
||||
HISTORY, ACCESS_LOG, PROPERTIES, OPEN_VIA_CLIENT, ONLYOFFICE_CONVERT, CONVERT_TO_MARKDOWN, CONVERT_TO_SDOC } = TextTranslation;
|
||||
const permission = dirent.permission;
|
||||
const { isCustomPermission, customPermission } = Utils.getUserPermission(permission);
|
||||
@@ -590,7 +590,11 @@ export const Utils = {
|
||||
list.push(UNLOCK);
|
||||
}
|
||||
} else {
|
||||
list.push(LOCK);
|
||||
if (dirent.name.endsWith('.sdoc')) {
|
||||
list.push(FREEZE_DOCUMENT);
|
||||
} else {
|
||||
list.push(LOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user