# Embedded media post allowed groups conflicts with post moderation workflow: unhide! fails with ActiveRecord::RecordInvalid

**URL:** https://meta.discourse.org/t/embedded-media-post-allowed-groups-conflicts-with-post-moderation-workflow-unhide-fails-with-activerecord-recordinvalid/390575
**Category:** Bug
**Created:** [December 6, 2025, 11:30am UTC](https://meta.discourse.org/t/embedded-media-post-allowed-groups-conflicts-with-post-moderation-workflow-unhide-fails-with-activerecord-recordinvalid/390575 "2025-12-06T11:30:31Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![copymonopoly](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@copymonopoly](https://meta.discourse.org/u/copymonopoly)
#### Post date: [December 6, 2025, 11:30am UTC](https://meta.discourse.org/t/embedded-media-post-allowed-groups-conflicts-with-post-moderation-workflow-unhide-fails-with-activerecord-recordinvalid/390575/1 "2025-12-06T11:30:31Z")

</div>

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:

```plaintext
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**

1. Configure **Embedded media post allowed groups** , excluding low-trust users.
2. Use a user _not included_ in the allowed groups to create a post.
3. 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.)
4. A moderator edits the hidden post and inserts media (images/videos).
5. Attempt to unhide the post (either in the UI or via `post.unhide!` in Rails console).
6. The operation fails with:

`ActiveRecord::RecordInvalid Validation failed: Sorry, you can't embed media items in a post.`

---

_[View the full topic](https://meta.discourse.org/t/embedded-media-post-allowed-groups-conflicts-with-post-moderation-workflow-unhide-fails-with-activerecord-recordinvalid/390575)._
