mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-31 06:40:39 +00:00
add lock/relock log when open file via OnlyOffice
This commit is contained in:
parent
9316eecdc9
commit
758cb27f3f
@ -137,6 +137,7 @@ def onlyoffice_editor_callback(request):
|
||||
cache.delete(cache_key)
|
||||
|
||||
if is_pro_version() and if_locked_by_online_office(repo_id, file_path):
|
||||
logger.info('status {}: unlock {} in repo_id {}'.format(status, repo_id, file_path))
|
||||
seafile_api.unlock_file(repo_id, file_path)
|
||||
|
||||
# 4 - document is closed with no changes,
|
||||
@ -146,6 +147,7 @@ def onlyoffice_editor_callback(request):
|
||||
cache.delete(cache_key)
|
||||
|
||||
if is_pro_version() and if_locked_by_online_office(repo_id, file_path):
|
||||
logger.info('status {}: unlock {} in repo_id {}'.format(status, repo_id, file_path))
|
||||
seafile_api.unlock_file(repo_id, file_path)
|
||||
|
||||
return HttpResponse('{"error": 0}')
|
||||
|
@ -821,9 +821,11 @@ def view_lib_file(request, repo_id, path):
|
||||
if is_pro_version() and can_edit:
|
||||
try:
|
||||
if not is_locked:
|
||||
logger.info('{} lock {} in repo {} when open it via OnlyOffice.'.format(ONLINE_OFFICE_LOCK_OWNER, path, repo_id))
|
||||
seafile_api.lock_file(repo_id, path, ONLINE_OFFICE_LOCK_OWNER,
|
||||
int(time.time()) + 40 * 60)
|
||||
elif locked_by_online_office:
|
||||
logger.info('{} relock {} in repo {} when open it via OnlyOffice.'.format(ONLINE_OFFICE_LOCK_OWNER, path, repo_id))
|
||||
seafile_api.refresh_file_lock(repo_id, path,
|
||||
int(time.time()) + 40 * 60)
|
||||
except Exception as e:
|
||||
|
Loading…
Reference in New Issue
Block a user