feat(editor): per-platform media assignment UI - #12
Merged
Merged
Conversation
Cryptoom
force-pushed
the
claude/tpx-08-a5-vue-ui
branch
from
September 16, 2026 23:03
c5cae71 to
ad169c5
Compare
Adds a media toggle grid to each platform card in the post editor (Edit.vue), letting the user narrow which media items a specific platform publishes. Default is "all on", matching today's unscoped behaviour (empty pivot = applies to every post media item, per A1). New state `platformMediaIds` threads through PostEditorTabs -> ScheduleTab -> ChannelConfigurator -> new MediaAssignmentGrid.vue, mirroring the existing platformContentTypes/platformMeta pattern. Backend: UpdatePostRequest validates `platforms.*.media_ids` against the media on this same request (IDOR guard), UpdatePost syncs the PostPlatform::media() pivot (Arr::has distinguishes an omitted key from an explicit empty-array clear). PostController::edit() appends media_ids per PostPlatform instance only (not globally via $appends), so the Index/Calendar listings that don't eager-load `media` aren't hit with an unwanted lazy load under strict model mode. Verified with Playwright against a locally seeded post/platforms: toggling excludes a media item from that platform's grid only, persists across reload, and the excluded item stays visually distinct (checkmark badge uses the existing emerald-200 "success" token) at both desktop (1920x1080) and mobile (iPhone 15 Pro, 393x852) widths. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Two fixes from review: 1. Toggle-off-everything bug: an empty platformMediaIds array means "unscoped, applies to all" everywhere it's read (scopedMediaItems(), the grid itself), so it can never also mean "explicitly none". Deselecting the last remaining item flipped the array back to [] and silently re-included every item, the opposite of what the user just did. MediaAssignmentGrid.toggle() now keeps the last remaining item on: a platform always publishes at least one of the post's media items when scoped. 2. Design review: MediaAssignmentGrid.vue rendered as a bare div with no card wrapper, so two selected platforms produced two identical, unbordered "Media for this channel" blocks with no visible way to tell which belonged to which platform. It now uses the same card pattern as its sibling settings panels (DiscordSettings.vue et al, rounded-xl border-2 border-foreground bg-card shadow-2xs) with a platform icon header, and the checkmark badge reuses the existing Badge variant="success" token instead of duplicating its classes. Verified with Playwright: toggling item 1, then item 2, then item 3 off on a 3-item post leaves item 2 on (the guard fires on the third click instead of silently clearing back to "all"), and the two platform cards are now visually distinct with their own borders and platform icons. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds a browser test for the off-by-one fix in ad169c5: with 3 media items on a post, deselecting item 1 then item 2 leaves item 3 as the last remaining selection, and a third click on item 3 must be a no-op (the platform can never end up scoped to zero items, since an empty selection is read as "unscoped, applies to all" everywhere else). Asserts item 3 stays selected AND items 1/2 stay deselected after the guarded click, which is the part a weaker assertion (checking only that item 3 is still on) would miss: a regression to the old bug would silently flip the selection back to "all", re-including items 1 and 2 too.
Cryptoom
force-pushed
the
claude/tpx-08-a5-vue-ui
branch
from
September 17, 2026 06:39
f42c054 to
6350a24
Compare
Cryptoom
added a commit
that referenced
this pull request
Sep 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
platformMediaIdsstate threads through PostEditorTabs to ScheduleTab to ChannelConfigurator to new MediaAssignmentGrid.vue, mirroring the existingplatformContentTypes/platformMetapattern.platforms.*.media_idsagainst the media on this same request (IDOR guard), UpdatePost action syncs thePostPlatform::media()pivot (Arr::hasdistinguishes an omitted key, left untouched, from an explicit empty-array clear). PostController::edit() appendsmedia_idsper PostPlatform instance only (not globally via$appends), so Index/Calendar listings that don't eager-loadmediaaren't hit with an unwanted lazy load under strict model mode.posts.edit.media_assignment.label/included/excludedadded to all 16 locales.media_ids/post_platform_idssupport is A4's PR feat(mcp): per-platform media parameters for attach and update tools #13, not duplicated here.Review fixes (second commit)
Two real findings from the first review round, both fixed:
[], which means "unscoped, applies to all" everywhere it's read, silently re-including every item instead of leaving none selected. Fixed by keeping the last remaining item on: a platform always publishes at least one media item once scoped.Badge variant="success"token instead of duplicating its classes.Screenshot review
Verified with Playwright against a locally seeded post (2 platforms, 3 media items):
Test plan
vendor/bin/pest tests/Feature/PostControllerTest.php tests/Feature/UpdatePostRequestTest.php tests/Feature/LocalizationParityTest.php(121 passed)--filter Postsuite (983 tests) green after rebase onto A2 (fix(posts): per-platform media validation instead of shared list #11) and A3 (refactor(publishers): use PostPlatform::scopedMediaItems() instead of shared post media #10)vendor/bin/pint --format agentpassedvue-tsc --noEmitzero errors in touched filesGenerated with Claude Code