1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 17:33:18 +00:00

update draft

This commit is contained in:
ilearnit
2019-03-07 08:41:56 +00:00
parent 2f7f2c0f19
commit 55dd843bd0
4 changed files with 8 additions and 4 deletions

View File

@@ -378,8 +378,8 @@ class Draft extends React.Component {
}
onPublishDraft = () => {
const OriginFileLink = siteRoot + 'lib/' + draftRepoID + '/file' + draftOriginFilePath + '/';
seafileAPI.publishDraft(draftID).then(res => {
const OriginFileLink = siteRoot + 'lib/' + draftRepoID + '/file' + encodeURIComponent(res.data.published_file_path) + '/';
window.location.href = OriginFileLink;
});
}

View File

@@ -230,7 +230,7 @@ class EditorUtilities {
publishDraftFile() {
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);
});
}

View File

@@ -118,8 +118,8 @@ class DraftView(APIView):
username = request.user.username
try:
d.publish(operator=username)
return Response(status.HTTP_200_OK)
published_file_path = d.publish(operator=username)
return Response({'published_file_path': published_file_path})
except DraftFileConflict:
return api_error(status.HTTP_409_CONFLICT,
'There is a conflict between the draft and the original file')

View File

@@ -243,6 +243,10 @@ class Draft(TimestampedModel):
)
self.delete(operator)
published_file_path = posixpath.join(file_uuid.parent_path, file_name)
return published_file_path
# get draft published version
# file_id = seafile_api.get_file_id_by_path(self.origin_repo_id, origin_file_path)