Skip to content

Commit

Permalink
Linkintegrity on root (#124)
Browse files Browse the repository at this point in the history
* enable linkintegrity also on site root

* add changelog

* fix changelog
  • Loading branch information
cekk authored Dec 2, 2024
1 parent d399432 commit 8d262c4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Changelog

- Add patch for blocksRetriever.
[eikichi18]

- Enable blocks linkintegrity on Site Root too.
[cekk]

5.6.2 (2024-11-28)
------------------
Expand Down
4 changes: 4 additions & 0 deletions src/redturtle/volto/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,8 @@
<implements interface="redturtle.volto.interfaces.ICustomFeedItem" />
</class>

<!-- enable linkintegrity also on site root -->
<class class="Products.CMFPlone.Portal.PloneSite">
<implements interface="plone.app.relationfield.interfaces.IDexterityHasRelations" />
</class>
</configure>
31 changes: 31 additions & 0 deletions src/redturtle/volto/tests/test_blocks_linkintegrity.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,3 +703,34 @@ def test_count_down_countdown_text_link_integrity(self):
self.assertEqual(len(reference["sources"]), 1)
self.assertEqual(reference["sources"][0]["uid"], self.document.UID())
self.assertEqual(reference["target"]["uid"], self.ref.UID())

def test_linkintegrity_works_also_on_site_root(self):
self.assertEqual(self.get_references(), [])
self.portal.blocks = {
"xyz": {
"@type": "testo_riquadro_semplice",
"simple_card_content": [
{
"type": "p",
"children": [
{
"type": "link",
"data": {
"url": f"/resolveuid/{self.ref.UID()}",
},
"children": [{"text": "foo"}],
},
],
}
],
}
}
notify(ObjectModifiedEvent(self.portal))

references = self.get_references()
reference = references[0]

self.assertEqual(len(references), 1)
self.assertEqual(len(reference["sources"]), 1)
self.assertEqual(reference["sources"][0]["uid"], self.portal.UID())
self.assertEqual(reference["target"]["uid"], self.ref.UID())

0 comments on commit 8d262c4

Please sign in to comment.