wordpress-activitypub icon indicating copy to clipboard operation
wordpress-activitypub copied to clipboard

[WIP] Federated Comments

Open mediaformat opened this issue 2 years ago • 3 comments

Restarting a fresh PR from #95

This currently includes code for Comments & Posts

Posts:

  • [x] Fixes Post Updates
  • [x] Fixes Deletes

Comments: Adds the ability to reply to comments from the Moderation page

  • [x] Comments support threading
  • [x] Local / Remote comments can be deleted
  • [x] Local / Remote comments can be updated

TODOs:

  • [ ] Complete Replies Collection
  • [x] Refactor AP object ID ( migrate from permalink to non-pretty permalinks example.com/?p={post_ID}) Discuss in #16
  • [ ] Upgrade script

mediaformat avatar Apr 15 '22 01:04 mediaformat

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 72 Code Smells

No Coverage information No Coverage information
3.1% 3.1% Duplication

sonarcloud[bot] avatar Apr 19 '22 05:04 sonarcloud[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 31 '22 00:08 stale[bot]

👀

johnspurlock avatar Aug 31 '22 00:08 johnspurlock

@pfefferle just a note that SonarCloud code smell uses rules that conflict with phpcs.

mediaformat avatar Sep 28 '22 17:09 mediaformat

Yea, ignore sonar cube!

pfefferle avatar Sep 28 '22 17:09 pfefferle

@mediaformat but there seems to be a conflict in activitypub.php.

pfefferle avatar Sep 29 '22 07:09 pfefferle

@mediaformat but there seems to be a conflict in activitypub.php.

@pfefferle I'm not seeing anything out of ordinary, any chance you could pinpoint the error? EDIT: Just saw the conflict and resolved it

mediaformat avatar Sep 29 '22 23:09 mediaformat

Nice, thanks. Is it still [WIP]?

pfefferle avatar Sep 30 '22 07:09 pfefferle

There is one last piece to this, a tools page for manually federating updates (deletes, or delete and announce with new ID).

mediaformat avatar Sep 30 '22 19:09 mediaformat

Ready to go!

mediaformat avatar Oct 02 '22 05:10 mediaformat

One more fix coming ;-)

mediaformat avatar Oct 05 '22 22:10 mediaformat

SonarCloud Quality Gate failed.    Quality Gate failed

Bug B 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell B 1856 Code Smells

No Coverage information No Coverage information
1.3% 1.3% Duplication

sonarcloud[bot] avatar Oct 07 '22 21:10 sonarcloud[bot]

Pagination of migrate-list.php / wp-admin/tools.php?page=activitypub_tools is not working, will fix, but shouldn't block review.

mediaformat avatar Oct 31 '22 21:10 mediaformat

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell B 1896 Code Smells

No Coverage information No Coverage information
1.3% 1.3% Duplication

sonarcloud[bot] avatar Nov 03 '22 15:11 sonarcloud[bot]

We should also add some tests.

pfefferle avatar Nov 13 '22 18:11 pfefferle

@pfefferle I added a view Posts with (activitypub) Comments to the Migration page.

There is a column which displays number of (published) comments. However some posts in this view may display 0 comment count (this number is only for published comments). Do you find that confusing? or have any suggestion?

Screen Shot 2022-11-19 at 5 15 32 PM

mediaformat avatar Nov 20 '22 01:11 mediaformat

@mediaformat I will fokus on this PR during the holidays and had a look at the migration part... I am not sure if this is a good idea, because it could be very distructive! I think we should stick with backwards compatibility in the first place.

pfefferle avatar Dec 23 '22 09:12 pfefferle

@mediaformat had a look at the migration part... I am not sure if this is a good idea, because it could be very distructive! I think we should stick with backwards compatibility in the first place.

Ok, I'll remove all that code. Backwards Compat then will only be checking first for permalink...

mediaformat avatar Jan 03 '23 06:01 mediaformat

What do you think about this way (at least as quick fix) https://github.com/pfefferle/wordpress-activitypub/pull/231 ?

pfefferle avatar Jan 03 '23 07:01 pfefferle

@pfefferle the \add_post_meta( $post_id, 'activitypub_canonical_url', \get_permalink( $post_id ), true ); looks good

mediaformat avatar Jan 03 '23 21:01 mediaformat

Is there a public WP instance where this is available to read from? Curious in how the AP payloads look for comments and posts.

johnspurlock avatar Feb 06 '23 17:02 johnspurlock

It is a pull request and not actually in stable afaik

On Mon, Feb 6, 2023, 9:26 AM John Spurlock @.***> wrote:

Is there a public WP instance where this is available to read from? Curious in how the AP payloads look for comments and posts.

— Reply to this email directly, view it on GitHub https://github.com/pfefferle/wordpress-activitypub/pull/142#issuecomment-1419456090, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANUKZUUHZLJ73KXRVDULHDWWEX57ANCNFSM5TPKQ6SA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

sunjam avatar Feb 06 '23 18:02 sunjam

I know, I'm just wondering if there is a staging server or something

johnspurlock avatar Feb 06 '23 18:02 johnspurlock

There isn't a staging server, I'm testing this locally with ngrok, and mastodon. The AP payloads are pretty typical/similar to other implementations

mediaformat avatar Feb 06 '23 23:02 mediaformat

Congrats on the acquisition - can't wait to unlock ActivityPub comments/replies for WP posts - hopefully this is still a priority!

johnspurlock avatar Mar 13 '23 20:03 johnspurlock

Ok, a few things broke and are left to fix

  • processing remote comments (update, delete)

Also, I'll probably extract the post/comments replies collection into a separate PR, to reduce the scope of this one.

mediaformat avatar Oct 01 '23 18:10 mediaformat

@mediaformat are you fine with me adding some changes directly to your PR?

pfefferle avatar Oct 05 '23 07:10 pfefferle

@mediaformat I planned to also work a bit more on the topic but then came the https://github.com/Automattic/wordpress-activitypub/issues/523.

I would love to:

  • [ ] simplify the code a bit (move global functions to transformer and similar stuff)
  • [ ] Start with inbox-handlers to have the code a bit more structured. If we have a good idea how to do it, we can adapt it for follow and Delete afterwards. Something like
    • /handler/class-create.php
    • /handler/class-like.php
    • /handler/class-update.php
  • [x] use the Mention class also for comments

What do you think?

pfefferle avatar Oct 27 '23 19:10 pfefferle

I would love to: * simplify the code a bit (move global functions to transformer and similar stuff) * Start with inbox-handlers to have the code a bit more structured. What do you think?

I agree with the simplification, and inbox handlers and all.

I ended up re-added some of the code that was removed, because I wanted to fix some bugs from where I left off last time (federation wasn't working well for deletes, edits). But it took a while to figure out why things weren't working. 😅

Anyhow everything is working again: threads, mentions, replies, edits, deletes. 🎉

mediaformat avatar Oct 27 '23 21:10 mediaformat

I would love to keep in in draft state for the next week, that it will not be merged by accident.

pfefferle avatar Oct 27 '23 22:10 pfefferle

?replytocom=1 seems to redirect even with ActivityPub Accept header.

pfefferle avatar Oct 27 '23 22:10 pfefferle