diff --git a/requirements.txt b/requirements.txt index 5be14b161c..fc498f9e39 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,3 +25,4 @@ openpyxl==3.0.* Markdown==3.4.* bleach==5.0.* python-ldap==3.4.* +pypinyin==0.50.* diff --git a/seahub/seadoc/apis.py b/seahub/seadoc/apis.py index 2c40ad8efa..a85b57f707 100644 --- a/seahub/seadoc/apis.py +++ b/seahub/seadoc/apis.py @@ -9,6 +9,7 @@ import posixpath from urllib.parse import unquote import time from datetime import datetime, timedelta +from pypinyin import lazy_pinyin from rest_framework.response import Response from rest_framework.views import APIView @@ -2849,6 +2850,8 @@ class SdocRelatedUsers(APIView): related_users = [] for email in related_user_emails: user_info = get_user_common_info(email) + user_name = user_info.get('name', '') + user_info['name_pinyin'] = "'".join(lazy_pinyin(user_name)) if user_name else '' related_users.append(user_info) return Response({'related_users': related_users})