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

تمكنت من الوصول إلى معظم الطريق من خلال الاطلاع على Custom Top Navigation Links.

<script type="text/discourse-plugin" version="0.8.18">
if (I18n.translations.en) {
    I18n.translations.en.js.filters.needsreply = {title: "Needs Reply", help: "Unanswered Topics"};
}

// CUSTOMIZE THESE VALUES
// Set the search query
let search_query = '?max_posts=1';
// Exclude certain categories from showing the needs reply menu item
let excludeList = ['pitches', 'weekly-recap', 'staff'];

api.addNavigationBarItem({
name: "needsreply",
displayName:"Needs Reply",
title: "Needs Reply",
href: "/latest" + search_query
});

// Add active class to Needs Reply button
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'));
        }
    }),
});


// Remove max_posts filter and tags filter
api.modifyClass('controller:discovery/topics', {
    resetParams: function () {
        this.setProperties({max_posts: null});
        this.setProperties({tags: null});
        this._super();
    }
});


</script>

الجزء الوحيد الذي لم أستطع حله بعد هو كيفية الوصول إلى التصنيف الحالي داخل هذا السكربت.

في الكود الأصلي، يسمح لك Discourse.NavItem بالوصول إلى التصنيف الحالي. بناءً على هذا الكود، نقوم بتعديل سلوك الرابط ديناميكيًا (إخفاؤه أو تغيير الـ href ليعرض المنشورات في هذا التصنيف فقط).

هل يمكن لأي شخص اقتراح حل لحقن التصنيف الحالي في السكربت أعلاه حتى أتمكن من تخصيص سلوك الرابط بناءً على التصنيف الذي يعرضه المستخدم؟

إعجاب واحد (1)