Skip to content

Scope tag-based collection attribution to the collection owner - #5

Merged
kibotu merged 1 commit into
mainfrom
fix/persona-claim-admin-only
Nov 18, 2026
Merged

kibotu merged 1 commit into
mainfrom
fix/persona-claim-admin-only

Conversation

@kibotu

@kibotu kibotu commented Nov 18, 2026

Copy link
Copy Markdown
Owner

What

Tag-based persona/collection attribution now applies only to entries authored by the collection owner (the admin account). Entries from other registered accounts keep their poster attribution, even when they carry a persona tag.

  • Entry::COLLECTION_CLAIM_JOIN_SQL adds the ownership check to the collection join, so non-owner entries resolve to no collection.
  • The collection-scoped query in searchAll() uses an inner join on the collection, so persona pages exclude non-owner entries too.
  • Collection::COLLECTION_SELECT counts only owner-authored entries, keeping sidebar/collection entry_count consistent with what is shown.
  • New integration test testNonOwnerEntriesAreNotClaimed (requires TRAIL_ADMIN_API_TOKEN and TRAIL_USER_API_TOKEN).

Review focus

The ownership predicate lives in LEFT JOIN trail_collections ... AND col.owner_user_id = e.user_id. A non-owner entry yields col = NULL and therefore collection => null, without touching the tag join or any entry filtering.

Verification

php -l clean on all three files. Integration test suite not executed locally (no vendor/); the new test self-skips without both tokens.

@kibotu
kibotu merged commit 62fec4e into main Nov 18, 2026
2 checks passed
@kibotu
kibotu deleted the fix/persona-claim-admin-only branch November 18, 2026 08:50
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.

1 participant