1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-02 07:47:32 +00:00

add monitored field when get repo info

This commit is contained in:
lian 2025-05-10 11:08:09 +08:00
parent 7d794157e9
commit 268ebfae9a

View File

@ -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)