From 268ebfae9a9a9df9e438842230e51a078712b517 Mon Sep 17 00:00:00 2001 From: lian Date: Sat, 10 May 2025 11:08:09 +0800 Subject: [PATCH] add monitored field when get repo info --- seahub/api2/endpoints/repos.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/seahub/api2/endpoints/repos.py b/seahub/api2/endpoints/repos.py index f3d8077aeb..9a3cf0a71a 100644 --- a/seahub/api2/endpoints/repos.py +++ b/seahub/api2/endpoints/repos.py @@ -395,6 +395,12 @@ class RepoView(APIView): has_been_shared_out = False logger.error(e) + monitored = False + monitored_repos = UserMonitoredRepos.objects.filter(email=username, + repo_id=repo_id) + if monitored_repos: + monitored = True + result = { "repo_id": repo.id, "repo_name": repo.name, @@ -416,7 +422,8 @@ class RepoView(APIView): "lib_need_decrypt": lib_need_decrypt, "last_modified": timestamp_to_isoformat_timestr(repo.last_modify), "status": normalize_repo_status_code(repo.status), - "enable_onlyoffice": enable_onlyoffice + "enable_onlyoffice": enable_onlyoffice, + "monitored": monitored, } return Response(result) @@ -541,7 +548,8 @@ class RepoShareInfoView(APIView): } return Response(result) - + + class RepoImageRotateView(APIView): authentication_classes = (TokenAuthentication, SessionAuthentication) permission_classes = (IsAuthenticated, ) @@ -572,7 +580,7 @@ class RepoImageRotateView(APIView): return api_error(status.HTTP_404_NOT_FOUND, error_msg) asset_name = os.path.basename(path) file_type, _ = get_file_type_and_ext(asset_name) - + if file_type != file_types.IMAGE: error_msg = '%s is not a picture.' % (path,) return api_error(status.HTTP_400_BAD_REQUEST, error_msg)