Skip to content

Commit

Permalink
fix comment at (#7008)
Browse files Browse the repository at this point in the history
Co-authored-by: 孙永强 <[email protected]>
  • Loading branch information
awu0403 and 孙永强 authored Nov 8, 2024
1 parent 25c8c9e commit f03a7bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
28 changes: 11 additions & 17 deletions seahub/seadoc/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

from seaserv import seafile_api, check_quota, get_org_id_by_repo_id, ccnet_api

from seahub.utils.ccnet_db import CcnetDB
from seahub.views import check_folder_permission
from seahub.api2.authentication import TokenAuthentication, SdocJWTTokenAuthentication, CsrfExemptSessionAuthentication
from seahub.api2.permissions import IsProVersion
Expand All @@ -51,7 +52,7 @@
get_file_history_by_day, get_file_daily_history_detail, HAS_FILE_SEARCH, HAS_FILE_SEASEARCH, gen_file_upload_url
from seahub.tags.models import FileUUIDMap
from seahub.utils.error_msg import file_type_error_msg
from seahub.utils.repo import parse_repo_perm
from seahub.utils.repo import parse_repo_perm, get_related_users_by_repo
from seahub.seadoc.models import SeadocHistoryName, SeadocRevision, SeadocCommentReply, SeadocNotification
from seahub.avatar.templatetags.avatar_tags import api_avatar_url
from seahub.base.templatetags.seahub_tags import email2nickname, \
Expand Down Expand Up @@ -2737,24 +2738,17 @@ def get(self, request, file_uuid):

repo_id = uuid_map.repo_id
org_id = get_org_id_by_repo_id(repo_id)
if org_id and org_id > 0:
related_user_emails = seafile_api.org_get_shared_users_by_repo(org_id, repo_id)
repo_owner = seafile_api.get_org_repo_owner(repo_id)
else:
related_user_emails = seafile_api.get_shared_users_by_repo(repo_id)
repo_owner = seafile_api.get_repo_owner(repo_id)

if repo_owner not in related_user_emails:
related_user_emails.append(repo_owner)

related_users = []
email_list_json = json.dumps(related_user_emails)
user_obj_list = ccnet_api.get_emailusers_in_list('DB', email_list_json)

for user_obj in user_obj_list:
if user_obj.is_active and '@seafile_group' not in user_obj.email:
user_info = get_user_common_info(user_obj.email)
try:
related_user_list = get_related_users_by_repo(repo_id, org_id)
db_api = CcnetDB()
user_obj_list = db_api.get_active_users_by_user_list(related_user_list)
for username in user_obj_list:
user_info = get_user_common_info(username)
related_users.append(user_info)
except Exception as e:
logger.error(e)
return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, 'Internal Server Error')

return Response({'related_users': related_users})

Expand Down
2 changes: 1 addition & 1 deletion seahub/utils/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def get_sub_folder_permission_by_dir(request, repo_id, parent_dir):
return folder_permission_dict

def get_shared_groups_by_repo(repo_id, org_id=None):
if not org_id:
if not org_id or org_id < 0:
group_ids = seafile_api.get_shared_group_ids_by_repo(
repo_id)
else:
Expand Down

0 comments on commit f03a7bf

Please sign in to comment.