Modificando variables relacionadas con 'Nuevo Tema'

Estoy intentando modificar el comportamiento de createTopicDisabled en tag-show.js. No logro sobrescribirlo como he visto aquí.


He intentado usar api.modifyClass() y api.modifyClassStatic() de esta manera:

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

Y esto:

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

Y varias otras variaciones.


También he intentado obtener el controlador predeterminado y volver a abrirlo, lo cual funcionó bien al sobrescribir acciones.

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

Hasta ahora, nada de esto ha funcionado realmente. Agradecería mucho cualquier ayuda.

1 me gusta