# 在类别顶部显示讨论事件

**URL:** <https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121>\
**Category:** Feature\
**Tags:** events\
**Created:** [2021年三月8日 21:48 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121 "2021-03-08T21:48:38Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)\
**Post date:** [2021年三月8日 21:48 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121/1 "2021-03-08T21:48:38Z")

</div>

你好，

Discourse：最新版本

我在测试该插件时，发现日历在分类中显示时并未展示事件。

原因似乎是帖子数据中的 `calendar_details` 字段为空。  
从第二张截图中可以看到，帖子已正确加载，`event` 字段存在，但 `calendar_details` 为空。

目前仅检查到这里。

![image](https://global.discourse-cdn.com/meta/original/3X/6/e/6ed82cd07a31744af78e2ac86516588aa2f45736.png)

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/e/cea8598a2ef5e335bbf3cfdbf25acbea05a6b26a.png)

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/e/8e196e3c877b0f3c749b33bd1cc7a41a48ead902.png)

 ![image](https://global.discourse-cdn.com/meta/original/3X/d/f/dffb00917fc8c3883c9ddb83f670974aa56b539b.png)

* * *

编辑：在日志中可以看到：

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/8/58ab3f8a3265608165f6066837fe00cad80ad028.png)

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/7/e71b74d0a8f3bbdaf04778d25ea75cd5a5c3792b.png)

编辑2：`/upcoming-events` 路由没有问题：

 ![image](https://global.discourse-cdn.com/meta/original/3X/b/c/bc929e90d31b09658cf7a4328dacc2ed3593ceae.png)

---

<div class="post-metadata">

**Author:** ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)\
**Post date:** [2021年三月22日 23:59 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121/2 "2021-03-22T23:59:52Z")

</div>

您好，这个_官方_插件是否仍在维护？

如果仍在维护，能否告知该问题是否已被确认？  
看到自己精心整理、力求详尽的帖子在 15 天后被随机删除，却不知具体原因，这确实会让人感到非常沮丧。

---

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [2021年三月23日 00:37 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121/3 "2021-03-23T00:37:28Z")

</div>

> [@Arkshine](#):
>
> 这个_官方_插件还在支持吗？

是的，仍在支持。我在尝试将日历附加到分类时遇到了和你一样的问题。日历已显示，但其中没有任何事件。我在日志中看到了和你相同的消息，浏览器控制台中也没有报错。我们会找 Discourse 团队的成员来调试问题所在。

---

<div class="post-metadata">

**Author:** ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)\
**Post date:** [2021年三月23日 11:04 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121/8 "2021-03-23T11:04:00Z")

</div>

我在本地开发环境中无法复现此问题。

 ![Screenshot 2021-03-23 at 16.35.21](https://global.discourse-cdn.com/meta/original/3X/f/f/ffd5c99fd76d2fde0e30eec24c50690cba5d557e.png)

 ![Screenshot 2021-03-23 at 16.36.11](https://global.discourse-cdn.com/meta/original/3X/e/4/e4f1ab54dd044f3c64630e5fc14cc33aa98deb4e.png)

@Arkshine 请注意，“日历类别”设置要求提供 `postId`。您确定提供的是日历主题的首帖 ID，而不是主题 ID 吗？

---

<div class="post-metadata">

**Author:** ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)\
**Post date:** [2021年三月23日 11:17 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121/9 "2021-03-23T11:17:53Z")

</div>

我不确定 `[calendar][/calendar]` 是否应该用于获取活动，它确实能获取日期，但活动嘛……有点不确定。我这么说是因为我从未见过它这样做。正如你提到的，活动是在 `/upcoming-events` 路由中获取的。不过，这倒可能是一个不错的功能。

---

<div class="post-metadata">

**Author:** ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)\
**Post date:** [2021年三月23日 11:34 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121/10 "2021-03-23T11:34:16Z")

</div>

> [@techAPJ](#):
>
> 请注意，`calendar categories` 设置要求提供 `postId`。你确定你提供的是日历主题的首帖 ID，而不是主题 ID 吗？

 ![](https://global.discourse-cdn.com/meta/original/3X/3/9/39119863d405ebbc01f8437747d6d5275a156ac1.png)

我认为这是正确的？

你可以看到，当你进入该分类时，它能正确获取帖子 ID。不过 `calendar_details` 却是空的。

 ![](https://global.discourse-cdn.com/meta/original/3X/1/f/1f294454c899d3a7fcdf1949ad0f9d539d0c7dba.png)

不确定我漏掉了什么？

---

<div class="post-metadata">

**Author:** ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)\
**Post date:** [2021年三月23日 11:41 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121/11 "2021-03-23T11:41:04Z")

</div>

我想我高兴得太早了。我检查了日历条目，但没检查事件。让我再尝试调试一次。

---

<div class="post-metadata">

**Author:** ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)\
**Post date:** [2021年三月29日 19:02 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121/13 "2021-03-29T19:02:44Z")

</div>

调试有什么进展吗？

---

<div class="post-metadata">

**Author:** ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)\
**Post date:** [2021年三月30日 01:58 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121/14 "2021-03-30T01:58:51Z")

</div>

@j.jaffeux 正在调查此问题。

---

<div class="post-metadata">

**Author:** ![Gawain](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gawain/32/215050_2.png) [@Gawain](https://meta.discourse.org/u/Gawain)\
**Post date:** [2021年四月8日 09:40 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121/16 "2021-04-08T09:40:23Z")

</div>

关于此事有最新进展吗？

---

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [2021年四月8日 13:40 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121/17 "2021-04-08T13:40:21Z")

</div>

好的，我查看了这个问题，@techAPJ 说得对，这个功能一直以来都是针对 `[calendar][/calendar]` 的，与事件无关。

我们从未支持在分类中显示事件。很抱歉，我知道这有点令人困惑，因为我们一直将所有功能都放在一个插件中。但日历和事件是两个不同的概念。

我可能会在某个时候添加在分类标题中显示/upcoming-events 的支持，但这目前不是优先事项。

---

<div class="post-metadata">

**Author:** ![Gawain](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gawain/32/215050_2.png) [@Gawain](https://meta.discourse.org/u/Gawain)\
**Post date:** [2021年四月10日 11:49 UTC](https://meta.discourse.org/t/showing-discourse-events-at-the-top-of-a-category/184121/18 "2021-04-10T11:49:45Z")

</div>

真可惜。我觉得在分类中显示空白日历没什么意义。

对我们来说，我们原本计划创建一个“活动”分类，该分类下的所有讨论都围绕某个特定的预定活动展开，然后顶部的日历只需显示该分类中所有即将举行的活动。

我们只是希望菜单中“即将举行的活动”链接里显示的日历也能出现在该分类中。

唉——希望未来能添加这个功能。
