mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-19 07:27:56 +00:00
Merge pull request #4917 from haiwen/onlyoffice-share-link
update view shared file
This commit is contained in:
commit
043dec900f
@ -1132,9 +1132,22 @@ def view_shared_file(request, fileshare):
|
|||||||
fileshare.view_cnt = F('view_cnt') + 1
|
fileshare.view_cnt = F('view_cnt') + 1
|
||||||
fileshare.save()
|
fileshare.save()
|
||||||
|
|
||||||
|
if not request.user.is_authenticated:
|
||||||
|
username = ANONYMOUS_EMAIL
|
||||||
|
else:
|
||||||
|
username = request.user.username
|
||||||
|
|
||||||
|
# check file lock info
|
||||||
|
try:
|
||||||
|
is_locked, locked_by_me = check_file_lock(repo_id, path, username)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
is_locked = False
|
||||||
|
locked_by_me = False
|
||||||
|
|
||||||
# get share link permission
|
# get share link permission
|
||||||
can_download = fileshare.get_permissions()['can_download']
|
can_download = fileshare.get_permissions()['can_download']
|
||||||
can_edit = fileshare.get_permissions()['can_edit']
|
can_edit = fileshare.get_permissions()['can_edit'] and not is_locked
|
||||||
|
|
||||||
# download shared file
|
# download shared file
|
||||||
if request.GET.get('dl', '') == '1':
|
if request.GET.get('dl', '') == '1':
|
||||||
@ -1180,19 +1193,7 @@ def view_shared_file(request, fileshare):
|
|||||||
|
|
||||||
if filetype in (DOCUMENT, SPREADSHEET):
|
if filetype in (DOCUMENT, SPREADSHEET):
|
||||||
|
|
||||||
if not request.user.is_authenticated:
|
|
||||||
username = ANONYMOUS_EMAIL
|
|
||||||
else:
|
|
||||||
username = request.user.username
|
|
||||||
|
|
||||||
def online_office_lock_or_refresh_lock(repo_id, path, username):
|
def online_office_lock_or_refresh_lock(repo_id, path, username):
|
||||||
# check file lock info
|
|
||||||
try:
|
|
||||||
is_locked, locked_by_me = check_file_lock(repo_id, path, username)
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(e)
|
|
||||||
is_locked = False
|
|
||||||
|
|
||||||
locked_by_online_office = if_locked_by_online_office(repo_id, path)
|
locked_by_online_office = if_locked_by_online_office(repo_id, path)
|
||||||
try:
|
try:
|
||||||
if not is_locked:
|
if not is_locked:
|
||||||
|
Loading…
Reference in New Issue
Block a user