# Reviewable insights中错误的加入日期和帖子数

**URL:** https://meta.discourse.org/t/wrong-join-date-and-post-count-in-reviewable-insights/391232
**Category:** Bug
**Tags:** review-queue, fixed
**Created:** [2025年十二月13日 20:59 UTC](https://meta.discourse.org/t/wrong-join-date-and-post-count-in-reviewable-insights/391232 "2025-12-13T20:59:43Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2025年十二月13日 20:59 UTC](https://meta.discourse.org/t/wrong-join-date-and-post-count-in-reviewable-insights/391232/1 "2025-12-13T20:59:43Z")

</div>

重现步骤：

1. 启用 `Reviewable UI refresh`，至少对管理员组启用。
2. 使用一个较早创建且有几篇帖子的管理员用户。
3. 标记（Flag）你自己的一个帖子。
4. 检查可复审项（reviewable）的洞察（insights）标签页。

**预期结果：**  
信任等级、加入日期和帖子数量是正确的。

**实际结果：**  
信任等级是正确的，加入日期是今天的日期，帖子数量是 0。  
请求似乎是针对正确的用户（ID 29），显示的数据作为响应看起来也是正确的。

 ![Wrong date](https://global.discourse-cdn.com/meta/original/4X/b/8/c/b8c8a69323aef5ee0f889c88ef270accba226f08.png)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2025年十二月15日 05:33 UTC](https://meta.discourse.org/t/wrong-join-date-and-post-count-in-reviewable-insights/391232/2 "2025-12-15T05:33:29Z")

</div>

抄送 @kris.kotlarek，看起来我们的日期弄错了

---

<div class="post-metadata">

### Author: ![kris.kotlarek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kris.kotlarek/32/176919_2.png) [@kris.kotlarek](https://meta.discourse.org/u/kris.kotlarek)
#### Post date: [2025年十二月15日 07:32 UTC](https://meta.discourse.org/t/wrong-join-date-and-post-count-in-reviewable-insights/391232/4 "2025-12-15T07:32:02Z")

</div>

感谢您报告此错误。

就帖子计数而言，感觉是正确的。要显示此数字，我们使用的是来自 `/reviewable/334.json` 请求的数据。`/admin/users/29.json` 请求的数据仅用于 IP 查找。

这两个请求的区别在于，第一个请求使用的是 `User.user_stat.post_count`，它只计算公开帖子（不包括私人分类和私人消息中的帖子）。第二个——管理员——请求返回所有帖子（包括私人分类和私人消息中的帖子）。

在我的情况下，显示的是 32，即使管理员的帖子计数是 36。

 ![Screenshot 2025-12-15 at 3.28.19pm](https://global.discourse-cdn.com/meta/original/4X/8/4/d/84d882744f981d00bd29d30347215250c3117f0f.png)  
 ![Screenshot 2025-12-15 at 3.29.05pm](https://global.discourse-cdn.com/meta/original/4X/a/b/e/abe19eb83b6b8990a49ecf9259ddd149e765d7e2.png)

您的用户是否可能有 5 条私人消息或受限分类中的帖子？

* * *

我仍在调查不正确的加入日期。刷新页面是否有帮助？

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2025年十二月15日 08:02 UTC](https://meta.discourse.org/t/wrong-join-date-and-post-count-in-reviewable-insights/391232/5 "2025-12-15T08:02:08Z")

</div>

不，这些帖子都位于分类中，就像我用来标记的那个一样。当加入日期错误时，帖子的数量始终为 0。

（我对我仍在 [https://github.com/discourse/discourse/commits/0e0e716e0d](https://github.com/discourse/discourse/commits/0e0e716e0d) 上的站点进行了重新测试。周末的重现是一个开发安装，因为我想确保在过去 10 天内没有任何变化）

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2026年四月14日 23:08 UTC](https://meta.discourse.org/t/wrong-join-date-and-post-count-in-reviewable-insights/391232/6 "2026-04-14T23:08:35Z")

</div>

我仍然可以复现此问题。用户信息中的加入日期是今天，帖子数量为 0。

 ![image](https://global.discourse-cdn.com/meta/original/4X/9/9/b/99bd4719595f5306d42a54e1f799405425f09e31.png)

---

<div class="post-metadata">

### Author: ![tannerabread](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tannerabread/32/526153_2.png) [@tannerabread](https://meta.discourse.org/u/tannerabread)
#### Post date: [2026年八月5日 15:22 UTC](https://meta.discourse.org/t/wrong-join-date-and-post-count-in-reviewable-insights/391232/10 "2026-08-05T15:22:28Z")

</div>

你好 @Moin ！

抱歉回复晚了，这个问题确实有点棘手。

> <https://github.com/discourse/discourse/pull/42145>
>
> Previously, the reviewable insights metadata was not being serialized correctly …for admin users that flagged their own posts. There was a conflict with the order of the \`has\_one\` associations in the \`ReviewableSerializer\`. When an admin flagged their own post, the user was identical for both the \`target\_created\_by\` and \`created\_by\` attributes. This silently dropped the \`target\_created\_by\` attribute, resulting in broken metadata (join date, post count) for the flagged post.
> 
> This commit reordered the \`has\_one\` associations in the \`ReviewableSerializer\` to ensure that \`target\_created\_by\` is serialized before \`created\_by\`.

原来，当举报人也是被举报用户时，序列化器会跳过该标签页所需的额外信息——我交换了 `created_by` 和 `target_created_by` 的顺序，从而强制先序列化 `target_created_by`，并正确填充了洞察标签页。

该修复现已包含在 `latest` 版本中。如果有机会的话，请试试看。

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2026年八月7日 15:51 UTC](https://meta.discourse.org/t/wrong-join-date-and-post-count-in-reviewable-insights/391232/12 "2026-08-07T15:51:13Z")

</div>


