-
Notifications
You must be signed in to change notification settings - Fork 83
Reply Block: Embed referenced post when possible #1100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
150cb7f to
3db22d2
Compare
jeherve
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working really well, nice work!
I've tested it with replies to posts on mastodon.social as well as smaller instances not mentioned in this PR, and non-Mastodon instances (in which case you can get a 401 on the embed request) and it's all displayed nicely.
I had a question about the design.
On Mastodon, loading a reply clearly displays the reply in focus, and the original post above it in a darker color. In WordPress, the original post naturally gets displayed above the reply so it has more emphasis than the reply you're writing.
I wonder if it would be helpful to clearly indicate "in response to" above the embed, or something like that, so it's clearer that the embed is the original post you're responding to?
|
@obenland can you maybe add some example screenshots to the PR? |
|
@pfefferle You can check some examples on my own site right now:
|
|
Thanks a lot @jeherve ! Should we make this configurable? This is a very big block that we add to each post!?! |
@obenland I added some microformats to match the https://indieweb.org/reply-context
|
@obenland I added some microformats to match the https://indieweb.org/reply-context |
That's a good question. I personally think it makes sense to provide all that context, but I could imagine some folks wanting a more consise display. How about adding a filter so folks could choose between an expanded and a compact view? Later on and if that proves necessary, we could make that a setting in the Reply block itself. |
@pfefferle do you mean when you're trying to embed a non-ActivityPub oEmbed? |
|
@mattwiebe if I use a mastodon instance that is not in the allow-list for example. As far as I understood the PR, the plugin should fall back to use ActivityPub to generate a preview based on that data, but that part does not work properly. |
In this case it was In cases like this, when it is not enabled, it would be nice to do a retry with authorized fetch. I will restrain myself from bloating this PR further heh. |
|
🤔 I thought we always send the signature... also for GET... I will check that and also check the preview with a different (not whitelisted) instance... |
|
Ah, I see... This is because of localhost! We send the signature, but it can't be verified, because the remote server can not access localhost! With a bonn.social site, it works like expected! |
jeherve
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave this PR another try, and currently run into this issue when I try to activate embedding for an existing post (with an embed from mastodon.social)
The same error appears on the frontend when I save my changes:
https://herve.bzh/sorvagsvatn-un-lac-aux-iles-feroe/
Interestingly, that error seems to be in response to an embed request using a Friends endpoint:
This may indicate a conflict with the Friends plugin (cc @akirk )
It doesn't happen with all replies, though. Another one is displayed properly for example (although I still run into the scrollbar issue I mentioned earlier).
The issue with duplicate mentions remains, though:
|
I think we're done here. I haven't been able to replicate @jeherve's embed failures, even alongside Friends. I moved to a shorter handle in replies to match #1510 . We already had an approval from @pfefferle and @obenland would you mind one final test? |
Yeah that's not good. The neverending PR continues to never end. :/ |
|
Ok, the WP embed has been solved. Unfortunately A perfect solution would then fall back to the ActivityPub representation, but I'm not doing that. :) |
jeherve
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still running into the same embed issues with Friends, but since that seems specific to my setup I'll let others test!
|
|
||
| // Generate HTML @ link. | ||
| return \sprintf( | ||
| '<p class="ap-reply-mention"><a rel="mention ugc" href="%1$s" title="%2$s">%3$s</a></p>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the wrapper to be a paragraph? Could it be a span? I'm mostly asking because it feels off to have the mention displayed on its own line before the reply. That's not what we typically see in other Fediverse software ; the @mention is usually immediately followed by the content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like removing the p makes much of a difference when using the block editor, even if we removed wpautop(), too. The following paragraph will be wrapped in its own paragraph tag and displayed on a new line.
|
@pfefferle @jeherve I think we've spent enough time on this PR, it's decision-time. Let's either merge it or close it. I'm happy for us to create follow-up PRs once it's in, but at some point we have to call it on this one, and I think this is it. |

Fixes #1027.
In this first pass the Mastodon embed provider only gets registered when the Reply block gets rendered. I'm open to making it generally available but initially it didn't feel like functionality that this plugin should be responsible for globally.
There's also an action to register additional Fediverse oembed providers beyond Mastodon.social. Not sure if there are others we should or need to consider.
The current implementation supports embedding posts from all supported oembed providers. I wasn't sure whether it should be limited to Mastodon or whether it should be all—please let me know if you have an opinion on that.
Finally, this maintains the anchor, that IndieWeb seems to be looking for.
Proposed changes:
Other information:
Testing instructions:
Testing Reply Block with Mastodon Posts:
Testing with Non-Embeddable URLs:
Testing with Other oEmbed Providers: