Skip to content
Snippets Groups Projects
Commit 1d783e846e87 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

ticket #343091, add missing schema synchronization related to BlogEntry permissions changes

parent 51f55a77be20
No related branches found
No related tags found
No related merge requests found
from cubicweb.selectors import implements from cubicweb.selectors import implements, score_entity
from cubicweb.sobjects.notification import ContentAddedView from cubicweb.sobjects.notification import NotificationView, StatusChangeMixIn
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
class BlogEntryAddedView(ContentAddedView): class BlogEntryPublishedView(StatusChangeMixIn, NotificationView):
"""get notified from new blogs""" """get notified from published blogs"""
__select__ = implements('BlogEntry',) __select__ = (implements('BlogEntry',)
& score_entity(lambda x: x.latest_trinfo().new_state.name == 'published')
)
content_attr = 'content' content_attr = 'content'
def subject(self): def subject(self):
......
sync_schema_props_perm('BlogEntry')
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
self.execute('SET E entry_of B WHERE B eid %(beid)s, E eid %(eeid)s' % {'beid' :cubicweb_blog.eid, 'eeid' : blog_entry_2.eid}) self.execute('SET E entry_of B WHERE B eid %(beid)s, E eid %(eeid)s' % {'beid' :cubicweb_blog.eid, 'eeid' : blog_entry_2.eid})
self.assertEquals(len(MAILBOX), 0) self.assertEquals(len(MAILBOX), 0)
self.commit() self.commit()
self.assertEquals(len(MAILBOX), 2) self.assertEquals(len(MAILBOX), 0)
blog_entry_1.fire_transition('publish')
self.commit()
self.assertEquals(len(MAILBOX), 1)
mail = MAILBOX[0] mail = MAILBOX[0]
self.assertEquals(mail.subject, '[data] hop') self.assertEquals(mail.subject, '[data] hop')
...@@ -25,5 +28,8 @@ ...@@ -25,5 +28,8 @@
mail = MAILBOX[0] mail = MAILBOX[0]
self.assertEquals(mail.subject, '[data] hop') self.assertEquals(mail.subject, '[data] hop')
blog_entry_2.fire_transition('publish')
self.commit()
self.assertEquals(len(MAILBOX), 2)
mail = MAILBOX[1] mail = MAILBOX[1]
self.assertEquals(mail.subject, '[data] yes') self.assertEquals(mail.subject, '[data] yes')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment