Commit graph

119 commits

Author SHA1 Message Date
94751480d6 make the save of a follower return the post id instead of the object and adopt unit tests
Some checks are pending
PHP_CodeSniffer / phpcs (push) Waiting to run
Unit Testing / phpunit (5.6, 6.2) (push) Waiting to run
Unit Testing / phpunit (7.0) (push) Waiting to run
Unit Testing / phpunit (7.2) (push) Waiting to run
Unit Testing / phpunit (7.3) (push) Waiting to run
Unit Testing / phpunit (7.4) (push) Waiting to run
Unit Testing / phpunit (8.0) (push) Waiting to run
Unit Testing / phpunit (8.1) (push) Waiting to run
Unit Testing / phpunit (8.2) (push) Waiting to run
Unit Testing / phpunit (latest) (push) Waiting to run
2023-12-27 16:45:23 +01:00
32acc511b1 decouple the adding/removing of follow relationships from adding/removing followers
Some checks are pending
PHP_CodeSniffer / phpcs (push) Waiting to run
Unit Testing / phpunit (5.6, 6.2) (push) Waiting to run
Unit Testing / phpunit (7.0) (push) Waiting to run
Unit Testing / phpunit (7.2) (push) Waiting to run
Unit Testing / phpunit (7.3) (push) Waiting to run
Unit Testing / phpunit (7.4) (push) Waiting to run
Unit Testing / phpunit (8.0) (push) Waiting to run
Unit Testing / phpunit (8.1) (push) Waiting to run
Unit Testing / phpunit (8.2) (push) Waiting to run
Unit Testing / phpunit (latest) (push) Waiting to run
also use post_content, and post_content_filtered to store the followers json object and inbox

fix phpcs

remove commented out code
2023-12-27 16:10:41 +01:00
Matthew Exon
a9c65f55d6
show admin notice when permalink structure is plain (#615)
* show admin notice when permalink structure is plain

fix #609

* fix phpcs issues

* remove calculation of static array of issues

* small changes

* removed unused attribute

---------

Co-authored-by: Matthew Exon <git.mexon@spamgourmet.com>
Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-12-22 11:42:20 +01:00
Matthias Pfefferle
b744dc551d
Comment Federation (#550)
* Comments 1

* Delete FUNDING.yml

* Add basic BuddyPress support

fix #122

thanks and props @skysarwer

* change URL to `bp_core_get_user_domain`

* fix "Follow" issue

fix #133

* fix #135

* version bump

* Create phpunit.yml

* Update composer.json

* Update composer.json

* Update phpunit.yml

* Update composer.json

* Create phpcs.yml

* Update phpcs.xml

* Update composer.json

* phpcs fixes

* fix typo

* Comments update

* webfinger_extract remove extra param

* coding standards

* Replies Collection, settings, other fixes

* Create stale.yml

* move stale file

* code standards cleanup

* Migrate / Update script

* bugfix

* add settings link to plugin page

* fix code standards

* fix cs

* fix PHPCS

* PHPCS fixes

* change background image for wp.org

* fix docker

* fix webfinger for email identifiers

fix #152

* version bump

* update composer file to fix unit testing

* allow plugins

* fix dependencies

* Migrate tools

* code cleanup

* regression fix

* Fix announce, clarified language

* update included filename

* code cleanup

* Improve migration UX

* Add comments view, warnings to migrate page

* style fix

* more style fixes

* Fix send_delete_activity

* replace ap_comment_id to reuse  replytocom var

* Comments class missing attributes

* Post class fix attributes

* move js file to assets/js

* Separate file for Comment processing hooks

* fix file path

* associate comments to back compat post

* Fix js assets enqueue

* change regex matching potential hashtags

Matches any string starting with '#' and consisting of any number and combination of [A-Za-z0-9_] that is directly followed by whitespace or punctuation. Groups everything after '#' for access in functions using this regex.

This fixes #183 (incomplete links on hashtags containing special characters) by not matching these at all.

* also detect hashtags at the start of a paragraph

* restrict html tags after which to detect a hashtag

Hashtags should not be detected after just any html tag - for example not after an opening a or div. To still allow detection at the start of a line, allow specifically p and br to directly precede a hashtag.

* fix pagination

* Add Custom Post Type support to outbox API

* remove comment_type

* fix comparison

* remove trailing spaces

* fix phpcs issues

* fix phpcs issues

* run phpcs also on pull_requests

* fix phpcs issues

* support threaded comments from ActivityPub

* refactor support for threaded comments from ActivityPub

* remove debugging log line

* add first unit tests for class inbox

* fix code smells

* make filter function static

* attempt to resolve backwards compatibility issues

* update js to new file

* delete old js

* Remove migrate code

* update post meta canonical

* remove type and mention meta from comment filters

* extract mentions from comment_content

* phpcbf

* remove extra curly bracket

* Remove migrate code

* remove version_check()

* Update enqueue scripts

* Remove remote comments from preprocessing

* Reply to comments from Dashboard

* rename function, inserts users into reply text

* Update dispatch comments

* update comment model

* fix comment model replies property

* fix preprocess_comment cap check

* Add webfinger filter to comments

* Add comment edit datetime

* cleanup

* fix var name

* cleanup

* phpcbf

* better actual translation support

* Separate comment reply script

* migrate dispatch, migrate comment model to transform

* ignore WP_Comment type for now

* Adds new helpers for resolving inReplyTo url

* Update activitypub_send_comment_activity to include type

* remove redundant id check

* reinclude user_id in saved ap_object meta

* update post field meta

* Fix comment updated datetime

* front-end reply inserts @mentions

* enqueue reply script on front end

* use const instead of dirname

* some simplifications

* move some functions

* fixes

* some more fixes

* fix namespace

* fix unittests

* fix testcase

* fixed typo

* fix tests

* fix tests

* fix PHPCS

* move functions to transformer class

* fix warnings

* Link remote comments on frontend

* Link to comment source as row action

* Init Comments class

* remove dead dispatch action

* re-add extract mentions filter

* Restore and tweak Comment transform

* Schedule comments activities for non-admin users

* lint

* remove context property

* rename get_id method to generate_id

* fix locale

* move functions

* PHPDoc

* this is never used

* remove some edit methods

* remove replies for now

* remove JS calls

* remove reply_recipients

* never used

* remove other query-vars

* otherwise to_json would not work properly

* small changes

* use `c` for comment IDs

* remove comments.php for now

maybe re-add it later

* wp_insert_post is an action

* also parse comment_text

* remove duplicate functions

* add Base transformer

* remove invalid test

* update to new query var

* update dispatcher to support comments and posts

* fix transition

* remove unused functions for now

* schedule_comment_activity seems to ignore create and update

* fix wrong use of functions!

* not every platforms sends an URL

* check source-id first

* remove hashtags for now

* fallback to ID

* fix typo

* move to_activity to Base class

* remove unused function

* add support for announce and like

* also ping inboxes of other commenters in the thread

* restructure WebFinger class

* some small improvements

* simplified to_object class

props @Menrath for the feedback and the idea!

* fix unit tests

* make transformer filterable

/cc @Menrath

* use transformer factory, so that transformer can be overwritten

* phpcs fixes

* fix attachments

* fix comment transformer

* remove comments for now

* update readme/changelog

* simplify and unify json_encodes

---------

Co-authored-by: Django Doucet <mediaformat.ux@gmail.com>
Co-authored-by: Andreas <andreas@bocops.de>
Co-authored-by: Eana Hufwe <eana@1a23.com>
Co-authored-by: Matthew Exon <git.mexon@spamgourmet.com>
Co-authored-by: Django Doucet <django.doucet@webdevstudios.com>
2023-12-22 10:12:26 +01:00
Kan-Ru Chen
a47c9cd7ae
replace excerpt_more with custom filter activitypub_excerpt_more for better consistency (#610) 2023-12-16 07:36:45 +01:00
Matthias Pfefferle
431c4a2676
WebFinger: Add support for URLs (#594)
* add support for URLs

* phpcs

* simplify vars
2023-12-11 10:28:41 +01:00
Matthias Pfefferle
e5fe4f20b7
some phpcs fixes (#590)
* some phpcs fixes

* add default $hashalg
2023-12-07 12:30:44 +01:00
Matthias Pfefferle
93b2f1ee7d
Normalize attributes that can have mixed value types (#586)
* fix #571

* support empty values

* fix phpcs issues

* test for `null`

* use `object_to_uri`  on followers list
2023-12-05 18:59:00 +01:00
Matthias Pfefferle
db846729db allow <p> and <br /> only for Activities 2023-12-05 13:21:24 +01:00
Matthias Pfefferle
15179f2c5a I think <p> and <br /> are fine for all usecases 2023-12-05 12:21:29 +01:00
Matthias Pfefferle
5d417d9f5c remove paging from get_all_followers
and add tests
2023-12-04 10:02:30 +01:00
Matthias Pfefferle
6e7f82bf42
Activity-Type based handlers (#551)
* init

* save source id

* fix delete and add improve undo

* test new functions

* add support for threaded comments

* some formatting

* check if URL is no longer available

...and returns either status 410 or 404.

* improve delete handler

* improve update handler

* `object` and `actor` are already required by the inbox endpoint

* fix typo

* simplify queries

* cosmetics

* fix unit tests

* schedule delete comments of deleted actor (#575)

* schedule delete comments of deleted actor

* phpcs

---------

Co-authored-by: Django Doucet <django.doucet@webdevstudios.com>

* move `get_comments_by_actor` to interactions collection

* consistent wording

* implement Tombstone

* fix follow issue

* fix inbox-create

* added missing namespace

* check if field is set

* Fix namespacing issue

* update profile and update interaction

* fields are already validated by inbox

* optimize avatar handling

---------

Co-authored-by: Django <mediaformat.ux@gmail.com>
Co-authored-by: Django Doucet <django.doucet@webdevstudios.com>
2023-11-30 11:43:48 +01:00
Matt Wiebe
33b61ca2b9
Shortcodes: only register when needed (#526) 2023-10-19 14:46:31 -05:00
Matthias Pfefferle
444c4b2837
Fixes PHP warnings and remote delete (#468)
* fix #463

* fix delete

/cc #465 @janboddez

* add disclaimer to not use the same name as an author login

see #470

* check if url is cached before trashing it
2023-09-27 11:05:11 +02:00
Alex Kirk
008ae52a53
Hashtags, Mentions: Use a tag stack instead of regex for protecting tags (#455)
* Use a tag stack instead of regex for protecting tags

* Use the placeholder in the test

* Add comments

* Update comment

* ignor html comments

thanks @marcS0H

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-09-21 17:03:57 +02:00
Matt Wiebe
8a74aa5891
Store keypairs as options keyed to user IDs. (#416) 2023-09-07 22:04:39 +02:00
Matthias Pfefferle
8dcbe0c6fd
fix Secops issues (#411) 2023-09-05 21:03:25 +02:00
Matthias Pfefferle
2705172b77
Fix some signature and application user issues (#410)
* Fix some signature and application user issues

* it seems that firefish needs at least an inbox also for application users

* prepare domain change

* use https

* fix PHPDoc

* remove image check

---------

Co-authored-by: Matt Wiebe <wiebe@automattic.com>
2023-09-01 18:32:56 +02:00
Dennis
26ad8975d7
Normalize Hashtag behavior in Mastodon Apps (#407)
* Update class-hashtag.php

* Update class-shortcodes.php

* fix unit tests

* missed two tests

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-08-31 15:04:17 +02:00
Matthias Pfefferle
e12cfa44ac
workaround for special chars (#379) 2023-07-28 00:39:22 +02:00
Matt Wiebe
5b9dadd6fd
Followers Block (#344)
Introduces a new Followers block. Proudly display your Fediverse followers to the world!

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-07-26 15:05:41 -05:00
Matthias Pfefferle
dd7daf29da simpler filter
thanks @mattwiebe
2023-07-20 18:33:24 +02:00
Matthias Pfefferle
f734e511f7 fix tests 2023-07-20 14:53:34 +02:00
Matthias Pfefferle
964ceee869 fix tests 2023-07-17 17:23:13 +02:00
Matthias Pfefferle
5ae978a8bc user_id could be an int and meta always returns strings
remove strict comparison in this case and add tests to verify the correct behaviour
2023-07-13 10:35:15 +02:00
Matthias Pfefferle
8920c60c61 final fixes and more tests 2023-07-10 15:14:37 +02:00
Matthias Pfefferle
0fab95bfff enhance tests to also test announce and blog wide activities 2023-07-10 14:59:35 +02:00
Matthias Pfefferle
81d0e09f6e fix wrong function names 2023-07-10 11:56:46 +02:00
Matthias Pfefferle
96c1e92151 optimize and simplify followers 2023-07-06 14:42:18 +02:00
Matthias Pfefferle
493b8ffad5 use transformer instead of post-model 2023-07-03 17:59:42 +02:00
Matthias Pfefferle
359eabf671 use collection instead of factory 2023-07-03 11:20:44 +02:00
Matthias Pfefferle
75a77b3f5c finalize account handling
still missing: publishing
2023-06-28 18:02:14 +02:00
Matthias Pfefferle
112eb51af1 updated signature feature to new structure 2023-06-27 14:29:42 +02:00
Matthias Pfefferle
235b5aa4a1 build a simple to_array converter 2023-06-26 11:08:04 +02:00
Matthias Pfefferle
5478be1355 a follower is now a valid ActivityPub Actor
this helps with API handling
2023-06-23 14:54:29 +02:00
Matthias Pfefferle
bbf40a5fec added more tests 2023-06-19 11:10:15 +02:00
Matthias Pfefferle
a71f79e979 test remove_follower 2023-06-19 11:05:01 +02:00
Matthias Pfefferle
793214cea2 now tests are green again 2023-06-16 11:40:26 +02:00
Matthias Pfefferle
46f376e05e fix tests 2023-06-15 12:24:13 +02:00
Matthias Pfefferle
96881b940a some refactorings and fixed the tests 2023-06-01 09:49:40 +02:00
Matthias Pfefferle
173e3abfa7 Merge branch 'signature_verification' of https://github.com/mediaformat/wordpress-activitypub into pr/299 2023-06-01 08:05:21 +02:00
Matthias Pfefferle
727aaf1c45 add signature regex test 2023-06-01 08:05:19 +02:00
Django Doucet
73cd19ec20 added test and pre_get_remote_key filter 2023-05-31 23:23:40 -06:00
Django Doucet
285925ea08 test_activity_signature 2023-05-31 06:35:58 -06:00
Matthias Pfefferle
2e537e423c
Merge branch 'master' into add/rest-namespace-constant 2023-05-16 08:10:06 +02:00
Matt Wiebe
3fa5e4f37e now with more use 2023-05-12 15:31:53 -05:00
Matt Wiebe
314ccf43a6 add a get_rest_url_by_path helper function, and use it 2023-05-12 15:24:24 -05:00
Matt Wiebe
abfa7c7969 Allow setting the REST namespace with ACTIVITYPUB_REST_NAMESPACE 2023-05-11 13:25:30 -05:00
Matthias Pfefferle
b803914180 removed output formatting 2023-05-11 09:46:26 +02:00
Matthias Pfefferle
26a1dc9be5 use time() instead of strtotime( 'now' ) 2023-05-10 18:52:13 +02:00