mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 22:54:11 +00:00
[delete] create draft menu (#2893)
This commit is contained in:
@@ -168,9 +168,6 @@ class DirentListItem extends React.Component {
|
||||
case 'Lock':
|
||||
this.onLockItem();
|
||||
break;
|
||||
case 'New Draft':
|
||||
this.onNewDraft();
|
||||
break;
|
||||
case 'Comment':
|
||||
this.onComnentItem();
|
||||
break;
|
||||
@@ -257,29 +254,6 @@ class DirentListItem extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
onNewDraft = () => {
|
||||
let repoID = this.props.repoID;
|
||||
let filePath = this.getDirentPath(this.props.dirent);
|
||||
seafileAPI.createDraft(repoID, filePath).then(res => {
|
||||
let draft_file_Path = res.data.draft_file_path;
|
||||
let draftId = res.data.id;
|
||||
let url = URLDecorator.getUrl({type: 'draft_view', repoID: repoID, filePath: draft_file_Path, draftId: draftId});
|
||||
let newWindow = window.open('draft');
|
||||
newWindow.location.href = url;
|
||||
}).catch((error) => {
|
||||
if (error.response) {
|
||||
let errMessage = 'Draft already exists.';
|
||||
if (errMessage === error.response.data.error_msg) {
|
||||
errMessage = gettext('Draft already exists.');
|
||||
toaster.danger(errMessage);
|
||||
}
|
||||
} else {
|
||||
let errMessage = gettext('Create draft failed.');
|
||||
toaster.danger(errMessage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onComnentItem = () => {
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap';
|
||||
import { gettext, isPro, enableFileComment, fileAuditEnabled, folderPermEnabled } from '../../utils/constants';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
currentRepoInfo: PropTypes.object.isRequired,
|
||||
@@ -63,9 +62,6 @@ class DirentMenu extends React.Component {
|
||||
menuList.push('Lock');
|
||||
}
|
||||
}
|
||||
if (Utils.isMarkdownFile(dirent.name)) {
|
||||
menuList.push('New Draft');
|
||||
}
|
||||
menuList.push('Divider');
|
||||
if (enableFileComment) {
|
||||
menuList.push('Comment');
|
||||
@@ -118,9 +114,6 @@ class DirentMenu extends React.Component {
|
||||
case 'Lock':
|
||||
translateResult = gettext('Lock');
|
||||
break;
|
||||
case 'New Draft':
|
||||
translateResult = gettext('New Draft');
|
||||
break;
|
||||
case 'Comment':
|
||||
translateResult = gettext('Comment');
|
||||
break;
|
||||
|
Reference in New Issue
Block a user