Modificando Variáveis relacionadas a 'Novo Tópico'

Estou tentando modificar o comportamento de createTopicDisabled no arquivo tag-show.js. Não consigo fazer com que ele seja sobrescrito da maneira que vi aqui.


Tentei usar api.modifyClass() e api.modifyClassStatic() assim:

api.modifyClass("controller:tag-show", {
    @discourseComputed(
        "canCreateTopic",
        "category",
        "canCreateTopicOnCategory",
        "tag",
        "canCreateTopicOnTag")
    createTopicDisabled(
        canCreateTopic,
        category,
        canCreateTopicOnCategory,
        tag,
        canCreateTopicOnTag)
    {
        return false;
    }
})

E também:

api.modifyClass("controller:tag-show", {
    createTopicDisabled: function() { return false; }
)

E várias outras variações.


Também tentei obter o controlador padrão e reabri-lo, o que funcionou bem ao sobrescrever ações.

const TagShowController = require('discourse/controllers/tag-show').default;
TagShowController.reopen({
    createTopicDisabled: function() {
        return false;
    }
})

Nada disso funcionou até agora. Qualquer ajuda seria muito apreciada.

1 curtida