1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-19 15:38:38 +00:00
This commit is contained in:
孙永强 2025-03-28 14:24:19 +08:00 committed by r350178982
parent 1d0b007958
commit 42d2b28ad9
2 changed files with 14 additions and 8 deletions

View File

@ -40,12 +40,14 @@ function WikiTopNav({ config, currentPageId, setCurrentPage, toggleFreezeStatus,
); );
})} })}
{paths.length > 0 && (
<IconButton <IconButton
id="lock-unlock-file" id="lock-unlock-file"
icon={lockUnlockIcon} icon={lockUnlockIcon}
text={lockUnlockText} text={lockUnlockText}
onClick={toggleFreezeStatus} onClick={toggleFreezeStatus}
/> />
)}
</div> </div>
); );
} }

View File

@ -510,6 +510,7 @@ class Wiki2PagesView(APIView):
'repo_id': repo_id, 'repo_id': repo_id,
'parent_dir': os.path.dirname(file_path), 'parent_dir': os.path.dirname(file_path),
'obj_name': file_name, 'obj_name': file_name,
'locked': False,
'mtime': timestamp_to_isoformat_timestr(file_obj.mtime) if file_obj else '' 'mtime': timestamp_to_isoformat_timestr(file_obj.mtime) if file_obj else ''
} }
@ -603,7 +604,8 @@ class Wiki2PagesView(APIView):
'name': page_name, 'name': page_name,
'path': path, 'path': path,
'icon': '', 'icon': '',
'docUuid': str(sdoc_uuid) 'docUuid': str(sdoc_uuid),
'locked': False
} }
pages.append(new_page) pages.append(new_page)
@ -880,7 +882,9 @@ class Wiki2PageView(APIView):
except ValueError: except ValueError:
error_msg = 'expire invalid.' error_msg = 'expire invalid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg) return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
is_locked = seafile_api.check_file_lock(repo_id, path.lstrip('/'), '')
if is_locked == locked:
return Response('success', status=status.HTTP_200_OK)
if locked: if locked:
try: try:
seafile_api.lock_file(repo_id, path.lstrip('/'), username, expire) seafile_api.lock_file(repo_id, path.lstrip('/'), username, expire)