1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-18 08:16:07 +00:00

Wiki mode optimized (#2442)

This commit is contained in:
山水人家
2018-10-13 17:07:54 +08:00
committed by Daniel Pan
parent 9805a33ef0
commit 6831d9e519
17 changed files with 585 additions and 137 deletions

View File

@@ -75,7 +75,8 @@ from seahub.utils.repo import get_repo_owner, get_library_storages, \
get_locked_files_by_dir, get_related_users_by_repo, \
is_valid_repo_id_format, can_set_folder_perm_by_user, \
add_encrypted_repo_secret_key_to_database
from seahub.utils.star import star_file, unstar_file
from seahub.utils.star import star_file, unstar_file, \
get_dir_starred_files
from seahub.utils.file_types import DOCUMENT
from seahub.utils.file_size import get_file_size_unit
from seahub.utils.file_op import check_file_lock
@@ -1893,7 +1894,7 @@ def get_dir_entrys_by_id(request, repo, path, dir_id, request_type=None):
"""
username = request.user.username
try:
dirs = seafserv_threaded_rpc.list_dir_with_perm(repo.id, path, dir_id,
dirs = seafile_api.list_dir_with_perm(repo.id, path, dir_id,
username, -1, -1)
dirs = dirs if dirs else []
except SearpcError, e:
@@ -1945,10 +1946,16 @@ def get_dir_entrys_by_id(request, repo, path, dir_id, request_type=None):
if e not in nickname_dict:
nickname_dict[e] = email2nickname(e)
starred_files = get_dir_starred_files(username, repo.id, path)
for e in file_list:
e['modifier_contact_email'] = contact_email_dict.get(e['modifier_email'], '')
e['modifier_name'] = nickname_dict.get(e['modifier_email'], '')
file_path = posixpath.join(path, e['name'])
e['starred'] = False
if normalize_file_path(file_path) in starred_files:
e['starred'] = True
dir_list.sort(lambda x, y: cmp(x['name'].lower(), y['name'].lower()))
file_list.sort(lambda x, y: cmp(x['name'].lower(), y['name'].lower()))