transformers: provide testing stuff
This commit is contained in:
parent
dd8d2778d5
commit
821ea76b01
1 changed files with 24 additions and 20 deletions
|
@ -80,26 +80,6 @@ The admin user interface in v1.0.0 lets one choose to which object type all post
|
||||||
* [ ] Article — The presentation of the "Article" might change on different platforms.
|
* [ ] Article — The presentation of the "Article" might change on different platforms.
|
||||||
* [ ] WordPress Post-Format — Maps the WordPress Post-Format to the ActivityPub Object Type.
|
* [ ] WordPress Post-Format — Maps the WordPress Post-Format to the ActivityPub Object Type.
|
||||||
|
|
||||||
### Proposal
|
|
||||||
All publicly accessible WordPress post types can become active for ActivityPub federation when selecting a transformer available for the relevant post type. The transformer determines the target ActivityPub object type, which can vary depending on variables like the post type or post format. If there is no specific transformer available for a given post type, it cannot be assigned through the user interface.
|
|
||||||
|
|
||||||
| | Note | Post-Format | The Events Calendar Transformer | Custom Event Transformer |
|
|
||||||
| ----------------- |:----:|:-----------:|:-------------------------------:|:------------------------:|
|
|
||||||
| **post** | X | O | - | - |
|
|
||||||
| **page** | O | O | - | - |
|
|
||||||
| **tribe_events** | O | - | X | O |
|
|
||||||
| **custom_event** | O | - | - | O |
|
|
||||||
| **...** | O | - | - | - |
|
|
||||||
|
|
||||||
**x:** Available transformers
|
|
||||||
**y:** Public and non-password protected WordPress post types
|
|
||||||
**Note:** Only one or zero selections can be made in each row.
|
|
||||||
|
|
||||||
- For any custom post type, if there is a custom transformer registered, indicate that one should be selected as default (or select it right ahead?).
|
|
||||||
- Should not differ too much from the current view: Maybe completely hide the current activity object type part of the settings and only show the buttons for `enable` and `disable` and move the transformer table to an advanced settings page.
|
|
||||||
- Maybe make the tables more advanced and clearly show the origin of the transformer (built-in, etc.) and maybe a Pop-Up with a description, or even a link to a configuration page of the transformer.
|
|
||||||
|
|
||||||
## Backend
|
|
||||||
Currently, only one hard-coded transformer exists in `includes/transformer/class post.php` ([Source](https://github.com/Automattic/wordpress-activitypub/blob/master/includes/transformer/class-post.php)).
|
Currently, only one hard-coded transformer exists in `includes/transformer/class post.php` ([Source](https://github.com/Automattic/wordpress-activitypub/blob/master/includes/transformer/class-post.php)).
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
@ -126,6 +106,29 @@ class Post {
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Proposal
|
||||||
|
All publicly accessible WordPress post types can become active for ActivityPub federation when selecting a transformer available for the relevant post type. The transformer determines the target ActivityPub object type, which can vary depending on variables like the post type or post format. If there is no specific transformer available for a given post type, it cannot be assigned through the user interface.
|
||||||
|
|
||||||
|
## Frontend
|
||||||
|
| | Note | Post-Format | The Events Calendar Transformer | Custom Event Transformer |
|
||||||
|
| ----------------- |:----:|:-----------:|:-------------------------------:|:------------------------:|
|
||||||
|
| **post** | X | O | - | - |
|
||||||
|
| **page** | O | O | - | - |
|
||||||
|
| **tribe_events** | O | - | X | O |
|
||||||
|
| **custom_event** | O | - | - | O |
|
||||||
|
| **...** | O | - | - | - |
|
||||||
|
|
||||||
|
**x:** Available transformers
|
||||||
|
**y:** Public and non-password protected WordPress post types
|
||||||
|
**Note:** Only one or zero selections can be made in each row.
|
||||||
|
|
||||||
|
|
||||||
|
- For any custom post type, if there is a custom transformer registered, indicate that one should be selected as default (or select it right ahead?).
|
||||||
|
- Should not differ too much from the current view: Maybe completely hide the current activity object type part of the settings and only show the buttons for `enable` and `disable` and move the transformer table to an advanced settings page.
|
||||||
|
- Maybe make the tables more advanced and clearly show the origin of the transformer (built-in, etc.) and maybe a Pop-Up with a description, or even a link to a configuration page of the transformer.
|
||||||
|
|
||||||
|
## Backend
|
||||||
|
|
||||||
A solution could be to define a transformer interface and let the transformers be implementations.
|
A solution could be to define a transformer interface and let the transformers be implementations.
|
||||||
```php
|
```php
|
||||||
interface Transformer {
|
interface Transformer {
|
||||||
|
@ -145,6 +148,7 @@ Use WordPress's hook system or a public API function to let other plugins regist
|
||||||
- The ActivityPub plugin could provide reusable Traits for common tasks.
|
- The ActivityPub plugin could provide reusable Traits for common tasks.
|
||||||
- Highly unlikely: The ActivityPub plugin provides an even more height level framework for adding transformers. For example for events the ActivityPub plugin could provide a built-in transformer to the object type `Event` which only needs a mapping (might make things harder, instead of making them easier). See Appendix.
|
- Highly unlikely: The ActivityPub plugin provides an even more height level framework for adding transformers. For example for events the ActivityPub plugin could provide a built-in transformer to the object type `Event` which only needs a mapping (might make things harder, instead of making them easier). See Appendix.
|
||||||
- Don't use an interface with implementations, (miss)use class extensions.
|
- Don't use an interface with implementations, (miss)use class extensions.
|
||||||
|
- Provide useful functions, documentation, and examples for automatic testing of transformers.
|
||||||
|
|
||||||
|
|
||||||
# Mapping: Actors and Dispatching
|
# Mapping: Actors and Dispatching
|
||||||
|
|
Loading…
Reference in a new issue