500 error when approving a reviewable post after editing tags in /review (tags saved as objects, not strings)

Summary

In the review queue (/review), if a moderator edits the tags on a queued post and then clicks Approve, the approval request fails with a 500 Internal Server Error.


Steps to Reproduce

  1. Ensure a post is waiting in the review queue (e.g., from a user/group that requires approval).
  2. Go to /review.
  3. Open the queued item.
  4. Edit tags using the tag selector UI.
  5. Click Approve.
  6. Observe a 500 response.

Expected Behavior

The post should be approved successfully, with the updated tags applied.


Actual Behavior

Approval fails with a 500 error.

Example request pattern:

PUT /review/{id}/perform/approve_post?version={x} → 500 (Internal Server Error)

What Seems To Be Happening (Root Cause)

After editing tags in the review UI, the reviewable payload stores full tag objects instead of tag name strings.

Before editing tags:

payload["tags"] = ["tag-one", "tag-two"]

After editing tags in /review:

payload["tags"] = [
  {"id"=>123, "name"=>"tag-one", "description"=>nil, "count"=>50, ...},
  {"id"=>456, "name"=>"tag-two", "description"=>nil, "count"=>30, ...}
]

When the approve action processes tags, it appears to expect strings, but receives hashes/objects, leading to the 500.


Workaround

Normalize tags back to names:

r = ReviewableQueuedPost.find(ID)
r.payload["tags"] = r.payload["tags"].map { |t| t.is_a?(Hash) ? t["name"] : t }
r.save!

Thanks for reporting. We’ll have a look.

1 Like