Skip to content

Trigger Actor updates on (un)setting a post as sticky. #1982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 23, 2025

Conversation

pfefferle
Copy link
Member

@pfefferle pfefferle commented Jul 22, 2025

Send Actor updates if the list of sticky posts change, to force remote platforms to re-read the "featured" endpoint.

Fixes: https://wordpress.com/blog/2025/07/18/3-fresh-features-activitypub-experience-for-wordpress/#comment-448212

Proposed changes:

  • Send Actor update when sticky posts list changes.

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Add a sticky post or remove it
  • Check the outbox for a new Actor Update Activity

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Trigger Actor updates on (un)setting a post as sticky.

@Jiwoon-Kim
Copy link

I’m not entirely convinced that the current “Sticky post” feature in WordPress — which is typically toggled via the Quick Edit or post editor — can fully capture the intended semantics in a fediverse context.

From experience, the concept of “pinning” content on federated profiles (e.g. Mastodon or Misskey) is better represented and understood when explicitly configured within the actor’s profile feed. It’s a social signal, not just a display tweak.

That makes me wonder — should this feature be considered more of a presentation layer element (handled locally), or should it be mapped to an Update activity for the Actor object itself across the fediverse?

In either case, it seems crucial to define:

How pinned/sticky state is stored at the AP level (in actor metadata? as a featured collection?),

Whether this state syncs with existing sticky_posts logic or diverges for ActivityPub purposes.

Would love to hear your thoughts on how to bridge these models — especially regarding backend implementation and compatibility with other platforms.

@Jiwoon-Kim
Copy link

While I agree that for single-profile "blog" actors this feature could be implemented relatively simply, I can foresee a potential side effect: the sticky status might also affect the site's native post feed (e.g., /posts or homepage query), which could unintentionally distort the intended layout or content flow.

In the ActivityPub context, pinning a post is usually more about visibility on the remote profile — it's a social affordance, not necessarily a site-wide editorial choice. If sticky posts start overriding local feed logic (e.g., query_posts() ordering), that might not be desirable for all users.

Perhaps it would make sense to differentiate "fediverse pinning" from traditional WordPress sticky_post behavior, or at least offer a toggle to prevent site-level layout interference when pinning posts for federation.

@Jiwoon-Kim
Copy link

The existing WordPress sticky_post feature doesn't align well with how pinned posts are used in the Fediverse, where they are typically tied to the actor's profile feed rather than the site's main post loop. A better approach might be to handle this separately using a custom meta_key like activitypub_sticky, allowing pinned posts to be managed specifically for ActivityPub without affecting the site's layout or behavior.

@pfefferle pfefferle changed the title Send Actor updates when post is (un)set to sticky Trigger Actor updates on (un)setting a post as sticky. Jul 23, 2025
@pfefferle pfefferle marked this pull request as ready for review July 23, 2025 16:40
@pfefferle pfefferle requested review from Copilot and obenland July 23, 2025 16:40
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds functionality to trigger Actor updates when posts are marked as sticky or unsticky, ensuring remote ActivityPub platforms refresh the "featured" endpoint to reflect changes in sticky post status.

Key changes:

  • Hooks into WordPress sticky posts option updates to detect changes
  • Triggers profile updates for authors whose posts have sticky status changes
  • Adds comprehensive test coverage for the sticky post detection functionality

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
includes/scheduler/class-actor.php Adds hook for sticky posts changes and implements detection logic to trigger Actor updates
tests/includes/scheduler/class-test-actor.php Adds test case to verify sticky post changes trigger appropriate Actor updates
Comments suppressed due to low confidence (1)

tests/includes/scheduler/class-test-actor.php:333

  • The test calls get_latest_outbox_item() but this method is not defined in the visible code. The test may fail if this helper method doesn't exist in the test class.
		$last_item = $this->get_latest_outbox_item();

@pfefferle pfefferle requested a review from obenland July 23, 2025 17:30
@pfefferle pfefferle merged commit 944521b into trunk Jul 23, 2025
11 checks passed
@pfefferle pfefferle deleted the add/update-sticky-posts branch July 23, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants