From 37791f4acf0391b5d99e7bd863780e2408e1e7a9 Mon Sep 17 00:00:00 2001 From: Tobias Johansson Date: Tue, 19 Feb 2019 14:16:28 +0100 Subject: [PATCH] Notifications regression: Notifications not created Notifications for when someone posted a comment on your node was not created. Root cause was that default values defined in schema was not set, resulting in activity subscriptions not being active. There were 2 bugs preventing them to be set: * The way the caching of markdown as html was implemented caused default values not to be set. * Eve/Cerberus regression causes nested default values to fail https://github.com/pyeve/eve/issues/1174 Also, a 3rd bug caused nodes without a parent not to have a subscription. Migration scripts: How markdown fields is cached has changed, and unused properties of attachments has been removed. ./manage.py maintenance replace_pillar_node_type_schemas Set the default values of activities-subscription ./manage.py maintenance fix_missing_activities_subscription_defaults --- pillarsdk/utils.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pillarsdk/utils.py b/pillarsdk/utils.py index 0326052..55929e8 100644 --- a/pillarsdk/utils.py +++ b/pillarsdk/utils.py @@ -178,10 +178,16 @@ def remove_private_keys(document): dictionary. """ + def do_remove(doc): + for key in list(doc.keys()): + if key.startswith('_'): + del doc[key] + elif isinstance(doc[key], dict): + doc[key] = do_remove(doc[key]) + return doc + doc_copy = copy.deepcopy(document) - for key in list(doc_copy.keys()): - if key.startswith('_'): - del doc_copy[key] + do_remove(doc_copy) try: del doc_copy['allowed_methods']