# 当缺少反应计数时，反应有时不会显示

**URL:** https://meta.discourse.org/t/reactions-sometimes-not-displayed-when-like-count-is-missing/391609
**Category:** Bug
**Tags:** reactions
**Created:** [2025年十二月17日 23:22 UTC](https://meta.discourse.org/t/reactions-sometimes-not-displayed-when-like-count-is-missing/391609 "2025-12-17T23:22:10Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2026年一月8日 10:20 UTC](https://meta.discourse.org/t/reactions-sometimes-not-displayed-when-like-count-is-missing/391609/5 "2026-01-08T10:20:22Z")

</div>

> [@Moin](#):
>
> 您能查出这是怎么发生的吗？

这是因为 `discourse_reactions_like_sync_enabled` 设置为 **`false`** 。这是在从[2024 年 5 月](https://github.com/discourse/discourse/blob/22e06e715126aec94b01bfcbdb40d9a9b6945441/plugins/discourse-reactions/db/migrate/20240521032001_disable_reactions_like_sync_for_existing_sites.rb)的迁移中故意为之，以避免干扰现有数据。

当此设置禁用时，`ReactionLikeSynchronizer` 不会运行。此同步器负责：

- 为反应创建 `PostAction`（点赞）记录
- 更新 `posts.like_count` 以反映反应

在同步不运行的情况下：

1. 反应存在于 `discourse_reactions_reaction_users` 中
2. 但没有相应的 `PostAction` 记录
3. 并且 `posts.like_count` 保持为 0

您对时间点的直觉是正确的——2023 年/2024 年初的帖子是在此同步不活动时添加了反应，因此它们的 `like_count` 从未更新。旧的序列化器逻辑在 `count = 0` 且 `can_act = false`（撤销窗口已过期）时会完全省略点赞操作。

修复程序不会纠正底层数据差异——它只是确保即使 `PostAction`/`like_count` 数据不同步，用户界面也能正确显示反应。在 `discourse_reactions_like_sync_enabled = false` 的站点上，独立于 `PostAction` 记录存在的反应是预期行为。

---

_[View the full topic](https://meta.discourse.org/t/reactions-sometimes-not-displayed-when-like-count-is-missing/391609)._
