Skip to content

fix(migration): prevent duplicate actor fields - #3638

Open
faisalahammad wants to merge 1 commit into
Automattic:trunkfrom
faisalahammad:fix/3339-extra-field-duplicates
Open

fix(migration): prevent duplicate actor fields#3638
faisalahammad wants to merge 1 commit into
Automattic:trunkfrom
faisalahammad:fix/3339-extra-field-duplicates

Conversation

@faisalahammad

Copy link
Copy Markdown

Fixes #3339

Proposed changes:

  • Prevent the "Powered by WordPress" extra field from being added more than once per actor. The migration seeder now skips insertion when a field with the same title already exists.
  • Add a migration step that runs once on upgrade and removes duplicate "Powered by" fields for the blog actor and every ActivityPub-capable user, keeping the oldest one.
  • The cleanup runs only when moving to the unreleased version, so fresh installs are unaffected and existing duplicates collapse to a single field.

Other information:

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

Testing instructions:

  • Install the plugin on a site that already has several duplicate "Powered by" fields in Settings → ActivityPub.
  • Run the upgrade (activate the updated plugin).
  • Confirm the field appears only once for the blog actor and for each user.
  • On a fresh install, confirm exactly one "Powered by" field is created per actor.
  • Delete the field manually, then run migrations again and confirm it is not re-added.

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

Fixed the "Powered by WordPress" profile field being added multiple times, and cleaned up any existing duplicates on update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Powered by WordPress

1 participant