Automattic / wordpress-activitypub

ActivityPub for WordPress
https://wordpress.org/plugins/activitypub/
MIT License
469 stars 68 forks source link

Bidirectional comments don't reply to the original comment #638

Open edent opened 6 months ago

edent commented 6 months ago

Quick summary

When I reply to a comment on my blog, it posts a new ActivityPub message - but it isn't in reply to the original comment.

Steps to reproduce

  1. Post on https://shkspr.mobi/blog/2020/03/it-is-spelled-url/
  2. This person replies https://post.lurk.org/@rose_alibi/111722787436930132
  3. I reply to their comment https://shkspr.mobi/blog/2020/03/it-is-spelled-url/#comment-363977
  4. The reply is sent without any context https://mastodon.social/deck/@blog@shkspr.mobi/111725492490736277

image

What you expected to happen

My comment should be in reply to the original comment. Or in reply to the original post.

What actually happened

The comment has no context, so looks a bit weird. Additionally, there's no setting to suppress comments from appearing.

Impact

One

Available workarounds?

No but the platform is still usable

Logs or notes

No response

edent commented 6 months ago

Ah! If I reply to someone who replied to my blog, it does thread properly.

Screenshot showing a threaded reply https://shkspr.mobi/blog/2023/12/the-joy-and-the-pity-of-making-your-own-stuff/#comment-363984

But, because it doesn't @ them, do they get notified?

This is excellent functionality! But I think it needs an option to be disabled when replying to regular comments. Otherwise there will be some very weird out of context posts.

pfefferle commented 6 months ago

But, because it doesn't @ them, do they get notified?

This is a known problem and I am experimenting on how to implement it nicely (I would love to have it without the @-reply thing at the beginning).

Otherwise there will be some very weird out of context posts.

Good point!

janboddez commented 6 months ago

Post on https://shkspr.mobi/blog/2020/03/it-is-spelled-url/ This person replies https://post.lurk.org/@rose_alibi/111722787436930132 I reply to their comment https://shkspr.mobi/blog/2020/03/it-is-spelled-url/#comment-363977

I think what might have happened here is their original reply was not to your blog actor, but to a crossposted/syndicated copy under your actual Mastodon account? And that Brid.gy backfed it to your blog.

Update: note even that, I think you just linked to it from a "toot." Brid.gy is like that, it'll attempt to send a webmention (?) even for replies to mere ... mentions.

Anybody replying to any other "toot" mentioning a URL of yours will trigger this behavior (in my experience). It can be confusing.

It also appears that all author/user comments make it back "to the Fediverse," even those (like in your example) that did not come (directly) from a "ActvitiyPub actor."

Ah! If I reply to someone who replied to my blog, it does thread properly.

Exactly, that's been my experience, too.

janboddez commented 6 months ago

Either way, it looks like the "real" issue (bug?) is that all of an author's comments get sent out "to the fediverse," even those not in reply to "fediverse comments."

That said, the plugin does seem to set a "inReplyTo" property: https://github.com/Automattic/wordpress-activitypub/blob/48a33b82e929725cdcd358c4b87fc188ec25764a/includes/transformer/class-comment.php#L136

Guessing Mastodon just doesn't know what to do with it?

Because I do think that in this specific case, had the inReplyTo been set to the comment's fediverse URL (which I think would be stored in webmention_source_url, given that the comment originated as a Bridgy (?) mention), that your reply would've been threaded "OK." This could be done using custom code. (Like, it's not straightforward, but I'm 100% sure it can be done.)

But the latter may not be a solution for other, "random" comments. I kinda also wanna be able to stop "irrelevant" (?) comments from being federated.

mikewmerritt commented 6 months ago

I'm wondering if there is a larger issue here. Last month I was noticing that replies made before the latest update were often not connecting to the original post, but the behavior was inconsistent.

pfefferle commented 6 months ago

I think this is an issue from the plugin not handling old comments properly, I am working on a fix!

KevinGimbel commented 3 months ago

I'm wondering if there is a larger issue here. Last month I was noticing that replies made before the latest update were often not connecting to the original post, but the behavior was inconsistent.

I'm seeing the same, second-level comments on my blog are assigned to the Home Page, not the post they were originally commented on.

Screenshot 2024-04-17 at 11 58 00
pfefferle commented 3 months ago

@KevinGimbel I can't see any issues on your screenshot. It shows the replies and it also lists the post properly. Do I muss something?

Screenshot 2024-04-17 at 12 43 42
KevinGimbel commented 3 months ago

Sorry, yes it's confusing.

In my screenshot the "In response to" is wrong - the top two comments are commenting on the Home Page of my blog, the other two are replies to the "Week 19: Fallout" post (as seen in your screenshot)

KevinGimbel commented 3 months ago

I would expect all comments to be nested under this post: https://kevingimbel.de/blog/2024/04/week-19-fallout#comments

pfefferle commented 3 months ago

This might be because it is simply an @-mention and not a reply to a post, which is currently not really supported. This might be a feature (not a bug ☺️) if you use a single page as home page.

KevinGimbel commented 3 months ago

Hmm I do use a single page as home page :D Should I open a feature request then? In terms of having - and preserving - conversations in the comment section it'd be good to have them properly nested

pfefferle commented 3 months ago

Ah, now I see! No, you are completely right, this is a bug!

pfefferle commented 3 months ago

Ah, it's because the comment id used by the ActivityPub plugin https://kevingimbel.de/?c=682 is pointing to your home-page instead of to the comment!

## Request
curl "https://kevingimbel.de/?c=682" \
     -H 'Accept: application/activity+json'

Do you have caching enabled?

pfefferle commented 3 months ago

This is how it should behave: https://notiz.blog/?c=1900601

and

## Request
curl "https://notiz.blog/?c=1900601" \
     -H 'Accept: application/activity+json'
KevinGimbel commented 3 months ago

Yes I use the WP Super Cache Plugin, I'll check if there's anything in the settings

KevinGimbel commented 3 months ago

Seems to work now - there was an option to not cache pages with GET parameters and now the link leads me to the comment.

KevinGimbel commented 3 months ago

I was too excited, the curl still doesn't work it seems 🤔

pfefferle commented 3 months ago

What plugin do you use for caching? Can you add an exception for different Accept headers (content negotiation)?

KevinGimbel commented 3 months ago

I'm using https://wordpress.org/plugins/wp-super-cache/ - I'll see if I can add exceptions

pfefferle commented 3 months ago

@donnchawp can you maybe support here?

donnchawp commented 3 months ago

I was not able to replicate this issue on my own site. I responded to a comment and it was seen as a reply on the first comment in the Mastodon web client. The page was cached by WP Super Cache when I commented as a logged-in user on my site.

Screenshot 2024-04-22 at 16 29 14

I noticed that @edent is using Litespeed cache which might have caused the problem. I'm not sure if it uses the Accept header in the cache key.

KevinGimbel commented 3 months ago

I just tried again and it doesn't work for me.

The top comment is assigned to the home-page again (coming from a reply on Mastodon).

Screenshot 2024-04-23 at 11 42 09
KevinGimbel commented 3 months ago

Same with WP Super Cache disabled - the third comment is always in reply to the home-page.

Screenshot 2024-04-23 at 11 45 37
KevinGimbel commented 3 months ago

The threading on Mastodon is correct, see https://fosstodon.org/@kevin@kevingimbel.de/112319876177431843 and https://fosstodon.org/@kevin@kevingimbel.de/112319888185816280