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

Usamos esse componente de tema há algum tempo, e hoje ele parou de funcionar.

Aqui está o código do componente (common, head_tag.html)

<!-- PRECISA DE RESPOSTA -->
<script type="text/discourse-plugin" version="0.8.18">
    if (I18n.translations.en) {
        I18n.translations.en.js.filters.needsreply = {title: "Precisa de Resposta", help: "Tópicos sem resposta"};
    }

    // PERSONALIZE ESSES VALORES
    // Defina a consulta de pesquisa
    let search_query = '?ascending=false&max_posts=1';
    // Exclua certas categorias da exibição do item de menu "Precisa de Resposta"
    let excludeList = ['pitches', 'weekly-recap', 'staff'];


    // Adicione a classe ativa ao botão "Precisa de Resposta"
    api.modifyClass('component:navigation-item', {
        active: Ember.computed("contentFilterMode", "filterMode", function () {
            let contentFilterMode = this.get('content').get('filterMode');
            if (window.location.search && window.location.search.split('&')[0] === search_query.split('&')[0]) {
                return contentFilterMode === "needsreply";
            } else {
                return this._super(contentFilterMode, this.get('filterMode'));
            }
        }),
    });

    // Remova o filtro max_posts e o filtro de tags
    api.modifyClass('controller:discovery/topics', {
        resetParams: function () {
            this.setProperties({max_posts: null});
            this.setProperties({tags: null});
            this._super();
        }
    });

    Discourse.ExternalNavItem = Discourse.NavItem.extend({
        href: function () {
            return this.get('href');
        }.property("href")
    });

    Discourse.NavItem.reopenClass({
        buildList: function (category, args) {
            let list = this._super(category, args),
                tag = args.tagId,
                needsreplyHref;

            if (!category) { // não possui categoria
                needsreplyHref = tag ? '/latest/' + search_query + '&tags=' + tag : '/latest/' + search_query; // se houver uma tag, construa o href com a tag; caso contrário, retorne à visualização mais recente e à consulta de pesquisa
            }
            else if (excludeList.indexOf(category.slug) != -1) { // a categoria está na lista de exclusão, não faça nada
                return list; // retorne a lista sem criar o item de navegação personalizado
            }
            else if (!category.parentCategory) { // não é uma subcategoria
                needsreplyHref = tag ? '/c/' + category.slug + search_query + '&tags=' + tag : '/c/' + category.slug + search_query; // se houver uma tag, construa o href com tags e a categoria; caso contrário, retorne à consulta de pesquisa, etc.
            } else { // é uma subcategoria
                needsreplyHref = tag ? '/c/' + category.parentCategory.slug + '/' + category.slug + search_query + '&tags=' + tag :
                    '/c/' + category.parentCategory.slug + '/' + category.slug + search_query; // se houver uma tag, construa o href com tags, subcategoria e categoria; caso contrário, retorne à consulta de pesquisa, etc.
            }
            list.push(Discourse.ExternalNavItem.create({href: needsreplyHref, name: 'needsreply'}));
            return list;
        }
    });
</script>

Há um erro no console do JS:

E, investigando um pouco mais, encontrei esta postagem falando sobre o Discourse.NavItem estar obsoleto:

Alguma sugestão para reescrever isso sem a classe NavItem obsoleta?

2 curtidas