태그를 /review에서 편집한 후 승인 가능한 게시물을 승인할 때 500 오류 발생 (태그가 문자열이 아닌 객체로 저장됨)

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!

1개의 좋아요

Thanks for reporting. We’ll have a look.

3개의 좋아요

This will be fixed in FIX: Cater for reviewable tag payloads that have been saved as names by nattsw · Pull Request #37477 · discourse/discourse · GitHub. Highly appreciate the quick bug report.

4개의 좋아요

This topic was automatically closed after 2 days. New replies are no longer allowed.