Skip to content

Commit 0812126

Browse files
committed
Merge tag '5.6.1' into fix/nicename
* tag '5.6.1': (47 commits) Release 5.6.1 (Automattic#1542) Fix: Use specified time formatting for Outbox Activities (Automattic#1537) Fix: Default value for empty `movedTo` field (Automattic#1539) Fix: Post Interactions settings (Automattic#1540) Release 5.6.0 (Automattic#1534) lover significance (Automattic#1533) Scheduler: Don't federate Deletes of unfederated posts. (Automattic#1528) Move: use `$from` for object in `Move::externally` (Automattic#1531) Fix: Properly traverse the object hierarchy to get the ID (Automattic#1518) Mentions: Standardize around only displaying username (Automattic#1510) Tests: Reduce chance of time offsets (Automattic#1527) Import: Don't federate new attachments (Automattic#1526) Importer: Format import count number. (Automattic#1525) Move: Add a Mastodon importer (Automattic#1502) Move: use `$from` for object in `Move::internally` (Automattic#1516) Fix: Do not send self-replies (Automattic#1517) Fix: Delete Undone comments instead of trashing them (Automattic#1520) Dispatcher: Adhere to passed batch size. (Automattic#1514) Add interaction settings (Automattic#1395) Fix: Set proper default, to show Welcome screen by default (Automattic#1512) ...
2 parents 3a1896a + 7f5ee1d commit 0812126

File tree

96 files changed

+3101
-1066
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+3101
-1066
lines changed

.github/workflows/changelog.yml

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "Changelog entry"
22
on:
3-
pull_request:
3+
pull_request_target:
44
# The specific activity types are listed here to include "labeled" and "unlabeled"
55
# (which are not included by default for the "pull_request" trigger).
66
# This is needed to allow skipping enforcement of the changelog in PRs with specific labels,
@@ -161,8 +161,9 @@ jobs:
161161
PR_MESSAGE: '${{ steps.check-pr-body.outputs.message }}'
162162
uses: actions/github-script@v7
163163
with:
164+
github-token: ${{ secrets.API_TOKEN_GITHUB }}
164165
script: |
165-
const { repo: { owner, repo }, payload : { pull_request : { number, head : { ref } } } } = context;
166+
const { repo: { owner, repo }, payload : { pull_request : { number, head : { ref, repo: head_repo } } } } = context;
166167
167168
// Get the changelog information from the previous step.
168169
const significance = '${{ steps.check-pr-body.outputs.significance }}';
@@ -198,8 +199,64 @@ jobs:
198199
const path = `.github/changelog/${ number }-from-description`;
199200
core.info( `Creating changelog file: ${ path }` );
200201
202+
// Check if PR is from a fork
203+
const isFromFork = head_repo.full_name !== `${owner}/${repo}`;
204+
205+
if ( isFromFork ) {
206+
core.info( 'PR is from a fork, so we cannot create the changelog file automatically.' );
207+
// For forks, we cannot create the file automatically, so we add a helpful comment to the PR,
208+
// asking the contributor to create the file manually.
209+
const commentBody = `👋 Thanks for your contribution!
210+
211+
I see you have provided all the required changelog information in your PR description. To complete the process, you'll need to create a changelog file in your branch.
212+
213+
Please create a file named \`.github/changelog/${number}-from-description\` with this content:
214+
215+
\`\`\`
216+
${content}
217+
\`\`\`
218+
219+
You can do this by either:
220+
1. Running \`composer changelog:add\` in your local repository, or
221+
2. Creating the file manually with the content above
222+
223+
Once you've committed and pushed the file to your PR branch, the checks will pass automatically.`;
224+
225+
// Check for existing comments first
226+
let hasExistingComment = false;
227+
for await ( const response of github.paginate.iterator( github.rest.issues.listComments, {
228+
owner,
229+
repo,
230+
issue_number: +number,
231+
per_page: 100,
232+
} ) ) {
233+
for ( const comment of response.data ) {
234+
if ( comment.body.includes('👋 Thanks for your contribution!') ) {
235+
hasExistingComment = true;
236+
break;
237+
}
238+
}
239+
if ( hasExistingComment ) {
240+
core.info( 'A comment already exists, so we will not add another one.' );
241+
break;
242+
}
243+
}
244+
245+
// Only post the comment if we haven't posted one before
246+
if ( ! hasExistingComment ) {
247+
core.info( 'No existing comment found, so we will add a new one.' );
248+
await github.rest.issues.createComment( {
249+
owner,
250+
repo,
251+
issue_number: number,
252+
body: commentBody
253+
} );
254+
}
255+
return;
256+
}
257+
201258
try {
202-
// Create or update the file in the repository
259+
// For internal PRs, create the file automatically
203260
await github.rest.repos.createOrUpdateFileContents( {
204261
owner,
205262
repo,

.github/workflows/gardening.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,7 @@ jobs:
5757
{"path": "includes/class-blocks.php", "label": "[Focus] Editor"},
5858
{"path": "integration", "label": "[Focus] Compatibility"},
5959
{"path": "includes/collection", "label": "[Feature] Collections"},
60-
{"path": "includes/class-mailer.php", "label": "[Feature] Notifications"}
60+
{"path": "includes/class-mailer.php", "label": "[Feature] Notifications"},
61+
{"path": "includes/wp-admin/import", "label": "[Feature] Import"},
62+
{"path": "includes/wp-admin", "label": "[Feature] WP Admin"}
6163
]'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _site
88
package-lock.json
99
composer.lock
1010
.DS_Store
11+
.cursor
1112
.idea/
1213
.php_cs.cache
1314
.vscode/settings.json

CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,50 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [5.6.1] - 2025-04-02
9+
### Fixed
10+
- "Post Interactions" settings will now be saved to the options table. [#1540]
11+
- So not show `movedTo` attribute instead of setting it to `false` if empty. [#1539]
12+
- Use specified date format for `updated` field in Outbox-Activites. [#1537]
13+
14+
## [5.6.0] - 2025-04-01
15+
### Added
16+
- Added a Mastodon importer to move your Mastodon posts to your WordPress site. [#1502]
17+
- A default Extra-Field to do a little advertising for WordPress. [#1493]
18+
- Move: Differentiate between `internal` and 'external' Move. [#1533]
19+
- Redirect user to the welcome page after ActivityPub plugin is activated. [#1511]
20+
- The option to show/hide the "Welcome Page". [#1504]
21+
- User setting to enable/disable Likes and Reblogs [#1395]
22+
23+
### Changed
24+
- Logged-out remote reply button markup to look closer to logged-in version. [#1509]
25+
- No longer federates `Delete` activities for posts that were not federated. [#1528]
26+
- OrderedCollection and OrderedCollectionPage behave closer to spec now. [#1444]
27+
- Outbox items now contain the full activity, not just activity objects. [#1474]
28+
- Standardized mentions to use usernames only in comments and posts. [#1510]
29+
30+
### Fixed
31+
- Changelog entries: allow automating changelog entry generation from forks as well. [#1479]
32+
- Comments from Fediverse actors will now be purged as expected. [#1485]
33+
- Importing attachments no longer creates Outbox items for them. [#1526]
34+
- Improved readability in Mastodon Apps plugin string. [#1477]
35+
- No more PHP warnings when previewing posts without attachments. [#1478]
36+
- Outbox batch processing adheres to passed batch size. [#1514]
37+
- Permanently delete reactions that were `Undo` instead of trashing them. [#1520]
38+
- PHP warnings when scheduling post activities for an invalid post. [#1507]
39+
- PHP Warning when there's no actor information in comment activities. [#1508]
40+
- Prevent self-replies on local comments. [#1517]
41+
- Properly set `to` audience of `Activity` instead of changing the `Follow` Object. [#1501]
42+
- Run all Site-Health checks with the required headers and a valid signature. [#1487]
43+
- Set `updated` field for profile updates, otherwise the `Update`-`Activity` wouldn't be handled by Mastodon. [#1495]
44+
- Support multiple layers of nested Outbox activities when searching for the Object ID. [#1518]
45+
- The Custom-Avatar getter on WP.com. [#1491]
46+
- Use the $from account for the object in Move activity for external Moves [#1531]
47+
- Use the `$from` account for the object in Move activity for internal Moves [#1516]
48+
- Use `add_to_outbox` instead of the changed scheduler hooks. [#1481]
49+
- Use `JSON_UNESCAPED_SLASHES` because Mastodon seems to have problems with encoded URLs. [#1488]
50+
- `Scheduler::schedule_announce_activity` to handle Activities instead of Activity-Objects. [#1500]
51+
852
## [5.5.0] - 2025-03-19
953
### Added
1054
- Added "Enable Mastodon Apps" and "Event Bridge for ActivityPub" to the recommended plugins section. [#1450]
@@ -1075,6 +1119,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10751119
### Added
10761120
- initial
10771121

1122+
[5.6.1]: https://github.com/Automattic/wordpress-activitypub/compare/5.6.0...5.6.1
1123+
[5.6.0]: https://github.com/Automattic/wordpress-activitypub/compare/5.5.0...5.6.0
10781124
[5.5.0]: https://github.com/Automattic/wordpress-activitypub/compare/5.4.1...5.5.0
10791125
[5.4.1]: https://github.com/Automattic/wordpress-activitypub/compare/5.4.0...5.4.1
10801126
[5.4.0]: https://github.com/Automattic/wordpress-activitypub/compare/5.3.2...5.4.0

activitypub.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: ActivityPub
44
* Plugin URI: https://github.com/Automattic/wordpress-activitypub
55
* Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
6-
* Version: 5.5.0
6+
* Version: 5.6.1
77
* Author: Matthias Pfefferle & Automattic
88
* Author URI: https://automattic.com/
99
* License: MIT
@@ -19,7 +19,7 @@
1919

2020
use WP_CLI;
2121

22-
\define( 'ACTIVITYPUB_PLUGIN_VERSION', '5.5.0' );
22+
\define( 'ACTIVITYPUB_PLUGIN_VERSION', '5.6.1' );
2323

2424
// Plugin related constants.
2525
\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
@@ -102,6 +102,11 @@ function plugin_admin_init() {
102102
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Welcome_Fields', 'init' ) );
103103
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Blog_Settings_Fields', 'init' ) );
104104
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\User_Settings_Fields', 'init' ) );
105+
106+
if ( defined( 'WP_LOAD_IMPORTERS' ) && WP_LOAD_IMPORTERS ) {
107+
require_once __DIR__ . '/includes/wp-admin/import/load.php';
108+
\add_action( 'init', __NAMESPACE__ . '\WP_Admin\Import\load' );
109+
}
105110
}
106111
\add_action( 'plugins_loaded', __NAMESPACE__ . '\plugin_admin_init' );
107112

@@ -113,6 +118,19 @@ function plugin_admin_init() {
113118
)
114119
);
115120

121+
/**
122+
* Redirect to the welcome page after plugin activation.
123+
*
124+
* @param string $plugin The plugin basename.
125+
*/
126+
function activation_redirect( $plugin ) {
127+
if ( ACTIVITYPUB_PLUGIN_BASENAME === $plugin ) {
128+
\wp_safe_redirect( \admin_url( 'options-general.php?page=activitypub' ) );
129+
exit;
130+
}
131+
}
132+
\add_action( 'activated_plugin', __NAMESPACE__ . '\activation_redirect' );
133+
116134
\register_deactivation_hook(
117135
__FILE__,
118136
array(

assets/css/activitypub-admin.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.activitypub-settings {
22
max-width: 800px;
33
margin: 0 auto;
4+
position: relative;
45
}
56

67
.settings_page_activitypub .notice {
@@ -220,3 +221,23 @@ input.blog-user-identifier {
220221
.like .dashboard-comment-wrap .comment-author {
221222
margin-block: 0;
222223
}
224+
225+
.activitypub-settings .welcome-tab-close {
226+
position: absolute;
227+
top: 0px;
228+
right: 0px;
229+
font-size: 13px;
230+
padding: 0 5px 0 20px;
231+
text-decoration: none;
232+
z-index: 1;
233+
}
234+
235+
.activitypub-settings .welcome-tab-close::before {
236+
position: absolute;
237+
top: 0px;
238+
left: 0;
239+
transition: all .1s ease-in-out;
240+
font: normal 16px/20px dashicons;
241+
content: '\f335';
242+
font-size: 20px;
243+
}

0 commit comments

Comments
 (0)