# Reply reminder - Remind users to reply to new users topics with zero replies

**URL:** <https://meta.discourse.org/t/reply-reminder-remind-users-to-reply-to-new-users-topics-with-zero-replies/42644>\
**Category:** Feature\
**Tags:** pr-welcome\
**Created:** [2016年四月15日 23:45 UTC](https://meta.discourse.org/t/reply-reminder-remind-users-to-reply-to-new-users-topics-with-zero-replies/42644 "2016-04-15T23:45:51Z")\
**Posts on this page:** 1\
**Showing post:** 59

<div class="post-metadata">

**Author:** ![Grayden\_Shand](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/grayden_shand/32/166586_2.png) [@Grayden\_Shand](https://meta.discourse.org/u/Grayden_Shand)\
**Post date:** [2020年七月22日 15:41 UTC](https://meta.discourse.org/t/reply-reminder-remind-users-to-reply-to-new-users-topics-with-zero-replies/42644/59 "2020-07-22T15:41:41Z")

</div>

通过查看 [https://meta.discourse.org/t/custom-top-navigation-links/87225，我基本上已经完成了大部分工作。](https://meta.discourse.org/t/custom-top-navigation-links/87225%EF%BC%8C%E6%88%91%E5%9F%BA%E6%9C%AC%E4%B8%8A%E5%B7%B2%E7%BB%8F%E5%AE%8C%E6%88%90%E4%BA%86%E5%A4%A7%E9%83%A8%E5%88%86%E5%B7%A5%E4%BD%9C%E3%80%82)

```html
<script type="text/discourse-plugin" version="0.8.18">
if (I18n.translations.en) {
    I18n.translations.en.js.filters.needsreply = {title: "需要回复", help: "未回复的主题"};
}

// 自定义以下值
// 设置搜索查询
let search_query = '?max_posts=1';
// 从“需要回复”菜单项中排除特定分类
let excludeList = ['pitches', 'weekly-recap', 'staff'];

api.addNavigationBarItem({
name: "needsreply",
displayName:"需要回复",
title: "需要回复",
href: "/latest" + search_query
});

// 为“需要回复”按钮添加激活样式
api.modifyClass('component:navigation-item', {
    active: Ember.computed("contentFilterMode", "filterMode", function () {
        let contentFilterMode = this.get('content').get('filterMode');
        console.log(window.location.search.split('&')[0], search_query.split('&')[0])
        if (window.location.search && window.location.search.split('&')[0] === search_query.split('&')[0]) {
            return contentFilterMode === "needsreply";
        } else {
            return this._super(contentFilterMode, this.get('filterMode'));
        }
    }),
});

// 移除 max_posts 和 tags 过滤器
api.modifyClass('controller:discovery/topics', {
    resetParams: function () {
        this.setProperties({max_posts: null});
        this.setProperties({tags: null});
        this._super();
    }
});

</script>

```

唯一我还没弄明白的是如何在此脚本中访问当前分类。

在原始代码中，Discourse.NavItem 允许你访问当前分类。根据这段代码，我们可以动态地改变链接的行为（隐藏它，或者修改 href 使其仅查看该分类下的帖子）。

有人能推荐一种解决方案，将当前分类注入到上面的脚本中吗？这样我就可以根据用户正在查看的分类来定制链接的行为。

---

_[View the full topic](https://meta.discourse.org/t/reply-reminder-remind-users-to-reply-to-new-users-topics-with-zero-replies/42644)._
