From 4fc0fe5e11841d5a96894f6cd514901c5897ee1d Mon Sep 17 00:00:00 2001 From: skywalker Date: Mon, 5 Feb 2024 17:17:24 +0800 Subject: [PATCH] mark all sdoc notifications seen --- seahub/seadoc/apis.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/seahub/seadoc/apis.py b/seahub/seadoc/apis.py index 2c40ad8efa..436980de0b 100644 --- a/seahub/seadoc/apis.py +++ b/seahub/seadoc/apis.py @@ -990,6 +990,20 @@ class SeadocNotificationsView(APIView): result = {'notifications': notifications} return Response(result) + def put(self, request, file_uuid): + """ mark all notifications seen + """ + username = request.user.username + try: + SeadocNotification.objects.filter( + doc_uuid=file_uuid, username=username, seen=False).update(seen=True) + except Exception as e: + logger.error(e) + error_msg = 'Internal Server Error' + return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg) + + return Response({'success': True}) + def delete(self, request, file_uuid): """delete notifications seen """