mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-26 07:22:34 +00:00
Merge pull request #5827 from haiwen/add-freeze-operation
Add freeze operation
This commit is contained in:
@@ -33,6 +33,8 @@ class ExternalOperations extends React.Component {
|
|||||||
this.unsubscribeStar = eventBus.subscribe(EXTERNAL_EVENT.TOGGLE_STAR, this.toggleStar);
|
this.unsubscribeStar = eventBus.subscribe(EXTERNAL_EVENT.TOGGLE_STAR, this.toggleStar);
|
||||||
this.unsubscribeUnmark = eventBus.subscribe(EXTERNAL_EVENT.UNMARK_AS_DRAFT, this.unmark);
|
this.unsubscribeUnmark = eventBus.subscribe(EXTERNAL_EVENT.UNMARK_AS_DRAFT, this.unmark);
|
||||||
this.unsubscribeShare = eventBus.subscribe(EXTERNAL_EVENT.SHARE_SDOC, this.onShareToggle);
|
this.unsubscribeShare = eventBus.subscribe(EXTERNAL_EVENT.SHARE_SDOC, this.onShareToggle);
|
||||||
|
this.unsubscribeShare = eventBus.subscribe(EXTERNAL_EVENT.FREEZE_DOCUMENT, this.onFreezeDocument);
|
||||||
|
this.unsubscribeShare = eventBus.subscribe(EXTERNAL_EVENT.UNFREEZE, this.unFreeze);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@@ -79,6 +81,28 @@ class ExternalOperations extends React.Component {
|
|||||||
this.setState({isShowShareDialog: !this.state.isShowShareDialog});
|
this.setState({isShowShareDialog: !this.state.isShowShareDialog});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onFreezeDocument = () => {
|
||||||
|
const { repoID, docPath } = this.props;
|
||||||
|
seafileAPI.lockfile(repoID, docPath, -1).then((res) => {
|
||||||
|
const eventBus = EventBus.getInstance();
|
||||||
|
eventBus.dispatch(EXTERNAL_EVENT.REFRESH_DOCUMENT);
|
||||||
|
}).catch(error => {
|
||||||
|
let errMessage = Utils.getErrorMsg(error);
|
||||||
|
toaster.danger(errMessage);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
unFreeze = () => {
|
||||||
|
const { repoID, docPath } = this.props;
|
||||||
|
seafileAPI.unlockfile(repoID, docPath).then((res) => {
|
||||||
|
const eventBus = EventBus.getInstance();
|
||||||
|
eventBus.dispatch(EXTERNAL_EVENT.REFRESH_DOCUMENT);
|
||||||
|
}).catch(error => {
|
||||||
|
let errMessage = Utils.getErrorMsg(error);
|
||||||
|
toaster.danger(errMessage);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { repoID, docPath, docName, docPerm } = this.props;
|
const { repoID, docPath, docName, docPerm } = this.props;
|
||||||
const { isShowInternalLinkDialog, isShowShareDialog } = this.state;
|
const { isShowInternalLinkDialog, isShowShareDialog } = this.state;
|
||||||
|
@@ -6,7 +6,7 @@ import { Utils } from './utils/utils';
|
|||||||
import Loading from './components/loading';
|
import Loading from './components/loading';
|
||||||
import SdocEditor from './pages/sdoc/sdoc-editor';
|
import SdocEditor from './pages/sdoc/sdoc-editor';
|
||||||
|
|
||||||
const { serviceURL, avatarURL, siteRoot, lang, mediaUrl } = window.app.config;
|
const { serviceURL, avatarURL, siteRoot, lang, mediaUrl, isPro } = window.app.config;
|
||||||
const { username, name } = window.app.userInfo;
|
const { username, name } = window.app.userInfo;
|
||||||
const {
|
const {
|
||||||
repoID, repoName, parentDir, filePerm,
|
repoID, repoName, parentDir, filePerm,
|
||||||
@@ -45,6 +45,7 @@ window.seafile = {
|
|||||||
revisionId,
|
revisionId,
|
||||||
mediaUrl,
|
mediaUrl,
|
||||||
isFreezed,
|
isFreezed,
|
||||||
|
isPro: isPro === 'True' ? true : false,
|
||||||
};
|
};
|
||||||
|
|
||||||
ReactDom.render(
|
ReactDom.render(
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extra_data %}
|
{% block extra_data %}
|
||||||
|
isPro: '{{ is_pro }}',
|
||||||
docPath: '{{ path|escapejs }}',
|
docPath: '{{ path|escapejs }}',
|
||||||
docName: '{{ filename|escapejs }}',
|
docName: '{{ filename|escapejs }}',
|
||||||
docUuid: '{{ file_uuid }}',
|
docUuid: '{{ file_uuid }}',
|
||||||
|
@@ -2229,6 +2229,7 @@ def view_sdoc_revision(request, repo_id, revision_id):
|
|||||||
|
|
||||||
return_dict['can_share_file'] = False
|
return_dict['can_share_file'] = False
|
||||||
return_dict['filetype'] = 'SDoc'
|
return_dict['filetype'] = 'SDoc'
|
||||||
|
return_dict['is_pro'] = is_pro_version()
|
||||||
|
|
||||||
file_uuid = revision.doc_uuid
|
file_uuid = revision.doc_uuid
|
||||||
return_dict['file_uuid'] = file_uuid
|
return_dict['file_uuid'] = file_uuid
|
||||||
|
Reference in New Issue
Block a user