mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 17:33:18 +00:00
update draft
This commit is contained in:
@@ -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;
|
||||
});
|
||||
}
|
||||
|
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -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')
|
||||
|
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user