# 编辑/review中的标签后批准可审阅帖子时出现500错误（标签保存为对象而非字符串）

**URL:** <https://meta.discourse.org/t/500-error-when-approving-a-reviewable-post-after-editing-tags-in-review-tags-saved-as-objects-not-strings/395014>\
**Category:** Bug\
**Tags:** tags, review-queue, bug\
**Created:** [2026年二月3日 08:51 UTC](https://meta.discourse.org/t/500-error-when-approving-a-reviewable-post-after-editing-tags-in-review-tags-saved-as-objects-not-strings/395014 "2026-02-03T08:51:38Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![TheBaby5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thebaby5/32/178897_2.png) [@TheBaby5](https://meta.discourse.org/u/TheBaby5)\
**Post date:** [2026年二月3日 08:51 UTC](https://meta.discourse.org/t/500-error-when-approving-a-reviewable-post-after-editing-tags-in-review-tags-saved-as-objects-not-strings/395014/1 "2026-02-03T08:51:38Z")

</div>

## 摘要

在审核队列（`/review`）中，如果版主编辑了排队帖子的标签然后点击 **批准** ，批准请求将失败并返回 **500 内部服务器错误** 。

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/9/d/49d1785f1e3c3a22dfb90a981cccb990c720f95b.png)

* * *

## 复现步骤

1. 确保有一个帖子在审核队列中等待（例如，来自需要批准的用户/组）。
2. 访问 `/review`。
3. 打开排队中的项目。
4. 使用标签选择器 UI 编辑标签。
5. 点击 **批准** 。
6. 观察到 **500** 响应。

* * *

## 预期行为

帖子应成功批准，并应用更新后的标签。

* * *

## 实际行为

批准失败并出现 500 错误。

示例请求模式：

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

```

* * *

## 发生原因（根本原因）

在审核 UI 中编辑标签后，`reviewable` 有效载荷存储的是 **完整的标签对象** 而不是 **标签名称字符串** 。

**编辑标签前：**

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

```

**在 `/review` 中编辑标签后：**

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

```

当批准操作处理标签时，它似乎期望接收字符串，但接收到了哈希/对象，从而导致 500 错误。

* * *

## 解决方法

将标签规范化回名称：

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

```

* * *

---

_[View the full topic](https://meta.discourse.org/t/500-error-when-approving-a-reviewable-post-after-editing-tags-in-review-tags-saved-as-objects-not-strings/395014)._
