1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

add-delete-user-notification-api (#4485)

* add-delete-user-notification-api

* update-code
This commit is contained in:
Leo
2020-03-19 13:37:41 +08:00
committed by GitHub
parent 82ca4dcc79
commit 8ef7d18c15

View File

@@ -101,6 +101,22 @@ class NotificationsView(APIView):
return Response({'success': True})
def delete(self, request):
""" delete a notification by username
Permission checking:
1. login user.
"""
username = request.user.username
UserNotification.objects.remove_user_notifications(username)
cache_key = get_cache_key_of_unseen_notifications(username)
cache.delete(cache_key)
return Response({'success': True})
class NotificationView(APIView):