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
This commit is contained in:
2019-02-19 14:16:28 +01:00
parent 250c7e2631
commit 32e25ce129
14 changed files with 424 additions and 427 deletions

View File

@@ -4,6 +4,8 @@ This'll help us upgrade to new versions of Cerberus.
"""
import unittest
from pillar.api.node_types.utils import markdown_fields
from pillar.tests import AbstractPillarTest
from bson import ObjectId
@@ -219,10 +221,9 @@ class MarkdownValidatorTest(AbstractSchemaValidationTest):
'schema': {
'type': 'dict',
'schema': {
'content': {'type': 'string', 'required': True, 'validator': 'markdown'},
'_content_html': {'type': 'string'},
'descr': {'type': 'string', 'required': True, 'validator': 'markdown'},
'_descr_html': {'type': 'string'},
**markdown_fields('content', required=True),
**markdown_fields('descr', required=True),
'my_default_value': {'type': 'string', 'default': 'my default value'},
}
},
}}
@@ -239,6 +240,7 @@ class MarkdownValidatorTest(AbstractSchemaValidationTest):
'_content_html': '<h1>Header</h1>\n<p>Some text</p>\n',
'descr': 'je moeder',
'_descr_html': '<p>je moeder</p>\n',
'my_default_value': 'my default value'
}]}
self.assertEqual(expect, doc)
self.assertEqual(expect, self.validator.document)