1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 23:02:26 +00:00

update set_notices_seen

This commit is contained in:
lian
2016-08-19 15:00:10 +08:00
committed by lian
parent 996c67fdb7
commit 5a700d5f00
7 changed files with 60 additions and 37 deletions

View File

@@ -1255,31 +1255,6 @@ def get_popup_notices(request):
"notice_html": notice_html,
}), content_type=content_type)
@login_required_ajax
@require_POST
def set_notices_seen(request):
"""Set user's notices seen:
Arguments:
- `request`:
"""
content_type = 'application/json; charset=utf-8'
username = request.user.username
unseen_notices = UserNotification.objects.get_user_notifications(username,
seen=False)
for notice in unseen_notices:
notice.seen = True
notice.save()
# mark related user msg as read
if notice.is_user_message():
d = notice.user_message_detail_to_dict()
msg_from = d.get('msg_from')
UserMessage.objects.update_unread_messages(msg_from, username)
return HttpResponse(json.dumps({'success': True}), content_type=content_type)
@login_required_ajax
@require_POST
def set_notice_seen_by_id(request):