1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

Merge pull request #2216 from haiwen/online-office-lock

add try-exception when OnlineOffice lock file
This commit is contained in:
Daniel Pan
2018-07-19 16:58:49 +08:00
committed by GitHub

View File

@@ -642,10 +642,13 @@ def view_lib_file(request, repo_id, path):
return render(request, 'view_file_base.html', return_dict) return render(request, 'view_file_base.html', return_dict)
if is_pro_version() and action_name == 'edit': if is_pro_version() and action_name == 'edit':
if not is_locked: try:
seafile_api.lock_file(repo_id, path, ONLINE_OFFICE_LOCK_OWNER, 0) if not is_locked:
elif locked_by_online_office: seafile_api.lock_file(repo_id, path, ONLINE_OFFICE_LOCK_OWNER, 0)
seafile_api.refresh_file_lock(repo_id, path) elif locked_by_online_office:
seafile_api.refresh_file_lock(repo_id, path)
except Exception as e:
logger.error(e)
wopi_dict['doc_title'] = filename wopi_dict['doc_title'] = filename
wopi_dict['repo_id'] = repo_id wopi_dict['repo_id'] = repo_id
@@ -694,10 +697,13 @@ def view_lib_file(request, repo_id, path):
can_edit = True can_edit = True
if is_pro_version() and can_edit: if is_pro_version() and can_edit:
if not is_locked: try:
seafile_api.lock_file(repo_id, path, ONLINE_OFFICE_LOCK_OWNER, 0) if not is_locked:
elif locked_by_online_office: seafile_api.lock_file(repo_id, path, ONLINE_OFFICE_LOCK_OWNER, 0)
seafile_api.refresh_file_lock(repo_id, path) elif locked_by_online_office:
seafile_api.refresh_file_lock(repo_id, path)
except Exception as e:
logger.error(e)
send_file_access_msg(request, repo, path, 'web') send_file_access_msg(request, repo, path, 'web')
return render(request, 'view_file_onlyoffice.html', { return render(request, 'view_file_onlyoffice.html', {