There is a conflict between “Embedded media post allowed groups” and the post unhide workflow.
If a post is created by a user who is not in the allowed media groups and later gets hidden (via flags), when a moderator edits the hidden post and adds media, attempting to unhide the post will fail with:
ActiveRecord::RecordInvalid
Validation failed: Sorry, you can't embed media items in a post.
The unhide process re-runs media validation using the original author’s permissions, not the moderator’s, causing the unhide to fail.
Steps to Reproduce
- Configure Embedded media post allowed groups, excluding low-trust users.
- Use a user not included in the allowed groups to create a post.
- Have the post hidden by system flags.(I’m not fully sure here — it seems posts can only be hidden via flags, not manually by staff? Staff can hide topics but not individual posts. Please correct me if I’m wrong.)
- A moderator edits the hidden post and inserts media (images/videos).
- Attempt to unhide the post (either in the UI or via
post.unhide!in Rails console). - The operation fails with:
ActiveRecord::RecordInvalid Validation failed: Sorry, you can't embed media items in a post.