mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-23 04:18:21 +00:00
add try-except when set notice seen by id
This commit is contained in:
@@ -1534,7 +1534,14 @@ def set_notice_seen_by_id(request):
|
||||
content_type = 'application/json; charset=utf-8'
|
||||
notice_id = request.GET.get('notice_id')
|
||||
|
||||
notice = UserNotification.objects.get(id=notice_id)
|
||||
try:
|
||||
notice = UserNotification.objects.get(id=notice_id)
|
||||
except UserNotification.DoesNotExist as e:
|
||||
logger.error(e)
|
||||
return HttpResponse(json.dumps({
|
||||
'error': _(u'Failed')
|
||||
}), status=400, content_type=content_type)
|
||||
|
||||
if not notice.seen:
|
||||
notice.seen = True
|
||||
notice.save()
|
||||
|
Reference in New Issue
Block a user