Closed janboddez closed 1 month ago
Ah, parse_blocks
doesn't work with our blocks? Or rather, while innerblocks are returned, the "attribute/selector" attributes (i.e., those read from HTML) aren't. If we'd instead store them in a "JSON comment" attribute (but why would we do that, we don't have to) it'd work ...
See https://github.com/WordPress/gutenberg/issues/46029#issuecomment-1326330988 for a possible solution. Should work for reading the href. Otherwise DOMDocument
... or php-mf2. But those are slow ...
Made a first start: https://github.com/janboddez/indieblocks/blob/main/includes/class-activitypub-compat.php. Doesn't yet do mentions (notifications), and trimming off the reply context is super hacky, but it's something.
Going to port my findings back to the other plugin and keep this functionality there, I think.
So, https://github.com/janboddez/addon-for-activitypub already adds ActivityPub support. I mean, turn "IndieBlocks likes" into "actual" ActivityPub likes, etc. Similar to "Webmention likes."
But maybe we could add like, reply, and repost integration right into this plugin.
Since all of it depends on in-post content (rather than custom fields, tags, etc.), we wouldn't need to work around Gutenberg's
transition_post_status
and post meta quirks.Also, the other add-on does rely on php-mf2 to store ActivityPub URL and actor data in a custom field on save, and then works around those quirks when sending.
If we were to add this functionality to IndieBlocks, we probably should avoid all that and just parse the blocks on each request. Which adds a slight overhead but much less than running php-mf2 and not too much in comparison with what we're already doing (and WordPress itself is doing).