mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 02:42:47 +00:00
update draft
This commit is contained in:
@@ -378,8 +378,8 @@ class Draft extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onPublishDraft = () => {
|
onPublishDraft = () => {
|
||||||
const OriginFileLink = siteRoot + 'lib/' + draftRepoID + '/file' + draftOriginFilePath + '/';
|
|
||||||
seafileAPI.publishDraft(draftID).then(res => {
|
seafileAPI.publishDraft(draftID).then(res => {
|
||||||
|
const OriginFileLink = siteRoot + 'lib/' + draftRepoID + '/file' + encodeURIComponent(res.data.published_file_path) + '/';
|
||||||
window.location.href = OriginFileLink;
|
window.location.href = OriginFileLink;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -230,7 +230,7 @@ class EditorUtilities {
|
|||||||
|
|
||||||
publishDraftFile() {
|
publishDraftFile() {
|
||||||
return seafileAPI.publishDraft(draftID).then(res => {
|
return seafileAPI.publishDraft(draftID).then(res => {
|
||||||
window.location.href = serviceUrl + '/lib/' + repoID + '/file' + encodeURIComponent(draftOriginFilePath);
|
window.location.href = serviceUrl + '/lib/' + repoID + '/file' + encodeURIComponent(res.data.published_file_path);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -118,8 +118,8 @@ class DraftView(APIView):
|
|||||||
|
|
||||||
username = request.user.username
|
username = request.user.username
|
||||||
try:
|
try:
|
||||||
d.publish(operator=username)
|
published_file_path = d.publish(operator=username)
|
||||||
return Response(status.HTTP_200_OK)
|
return Response({'published_file_path': published_file_path})
|
||||||
except DraftFileConflict:
|
except DraftFileConflict:
|
||||||
return api_error(status.HTTP_409_CONFLICT,
|
return api_error(status.HTTP_409_CONFLICT,
|
||||||
'There is a conflict between the draft and the original file')
|
'There is a conflict between the draft and the original file')
|
||||||
|
@@ -243,6 +243,10 @@ class Draft(TimestampedModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.delete(operator)
|
self.delete(operator)
|
||||||
|
|
||||||
|
published_file_path = posixpath.join(file_uuid.parent_path, file_name)
|
||||||
|
|
||||||
|
return published_file_path
|
||||||
# get draft published version
|
# get draft published version
|
||||||
# file_id = seafile_api.get_file_id_by_path(self.origin_repo_id, origin_file_path)
|
# file_id = seafile_api.get_file_id_by_path(self.origin_repo_id, origin_file_path)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user