Prevent errors when notification is linked to non-existing node

This commit is contained in:
Sybren A. Stüvel 2016-10-20 17:43:51 +02:00
parent 8d99f8fc2e
commit 5677ae8532

View File

@ -17,6 +17,11 @@ def notification_parse(notification):
if activity is None or activity['object_type'] != 'node':
return
node = nodes_collection.find_one({'_id': activity['object']})
if not node:
# This can happen when a notification is generated and then the
# node is deleted.
return
# Initial support only for node_type comments
if node['node_type'] != 'comment':
return