Another things that I’m trying to do, if you have an answer that will avoid the need to create a separate topic.
I want to throw a validation message when the user only chooses one level of category.
I was attempting to override categoryValidation() of composer.js.es6 … except that is a @computed method.
Looking at https://github.com/discourse/discourse-assign/blob/master/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6#L69 this should be doable.
My issue is that from the <head>, I don’t have acces to @computed. Is there a way to require it?
I did manage to override the controller:composer save action. However, from there I don’t have access to InputValidation to throw a custom error (I wouldn’t know how to target the correct input from there either).
<script type="text/discourse-plugin" version="0.8.23">
api.modifyClass('controller:composer', {
@computed("model.categoryId", "lastValidatedAt") //ReferenceError: computed is not defined
categoryValidation() {
console.log('categoryValidation');
this._super();
}
});
</script>