1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-05-12 09:55:53 +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
frontend/src/pages/wiki2/top-nav
seahub/api2/endpoints

View File

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

View File

@ -510,6 +510,7 @@ class Wiki2PagesView(APIView):
'repo_id': repo_id,
'parent_dir': os.path.dirname(file_path),
'obj_name': file_name,
'locked': False,
'mtime': timestamp_to_isoformat_timestr(file_obj.mtime) if file_obj else ''
}
@ -603,7 +604,8 @@ class Wiki2PagesView(APIView):
'name': page_name,
'path': path,
'icon': '',
'docUuid': str(sdoc_uuid)
'docUuid': str(sdoc_uuid),
'locked': False
}
pages.append(new_page)
@ -880,7 +882,9 @@ class Wiki2PageView(APIView):
except ValueError:
error_msg = 'expire invalid.'
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:
try:
seafile_api.lock_file(repo_id, path.lstrip('/'), username, expire)