fix(posts): accept ai-generated media in post media validation - #23
Merged
Merged
Conversation
assertHostedMediaExists (877a2a9) only accepted the `assets` collection, but slides created by the AI image pipeline live in `ai-generated`. Publishing or scheduling an AI-created carousel from the editor failed with "Media not found." and the post stayed a draft. Allow both collections via PostMediaRules::POST_MEDIA_COLLECTIONS. The workspace ownership check is unchanged, so other workspaces' media and non-post collections such as `logo` are still rejected.
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.
Problem
Since #9 (877a2a9)
PostMediaRules::assertHostedMediaExistsonly accepted media in theassetscollection. Slides created by the AI image pipeline (PostImagePipeline,RegeneratePostMediaImage) are stored inai-generated. Clicking "Post now" or scheduling an AI-created carousel from the editor therefore failed withMedia not found.and the post stayed a draft.Confirmed against production data: the stuck draft's slide ids exist in
mediaswithcollection = ai-generated.Change
PostMediaRules::POST_MEDIA_COLLECTIONS = ['assets', 'ai-generated'], used by the existence check.logo,avatar) are still rejected.Tests
Three new tests in
PostMediaExistsValidationWebTest: accepts ai-generated media, rejects another workspace's ai-generated media, still rejects thelogocollection. The first one failed before the fix withMedia not found.Affected suites green: 414 passed (post media validation web + API, PostControllerTest, Mcp). Pint passes.
Not deployed.
🤖 Generated with Claude Code