Prevent errors when notification is linked to non-existing node
This commit is contained in:
parent
8d99f8fc2e
commit
5677ae8532
@ -17,6 +17,11 @@ def notification_parse(notification):
|
|||||||
if activity is None or activity['object_type'] != 'node':
|
if activity is None or activity['object_type'] != 'node':
|
||||||
return
|
return
|
||||||
node = nodes_collection.find_one({'_id': activity['object']})
|
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
|
# Initial support only for node_type comments
|
||||||
if node['node_type'] != 'comment':
|
if node['node_type'] != 'comment':
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user