From @angus post in Mattermost chat a few days ago:
To access an Ember closure action defined on another controller, you can use getOwner
import { getOwner } from 'discourse-common/lib/get-owner';
export default {
setupComponent(attrs, component) {
const controller = getOwner(this).lookup('controller:topic');
},
}
Once you have the controller you can use controller.send('action')
I can confirm this worked great. I reformatted the code a little, as per my example below:
import { getOwner } from 'discourse-common/lib/get-owner';
export default {
actions: {
convertPrivateStoryToPublicStory() {
const controller = getOwner(this).lookup('controller:topic');
controller.send('convertToPublicTopic')
},
convertPublicStoryToPrivateStory() {
const controller = getOwner(this).lookup('controller:topic');
controller.send('convertToPrivateMessage')
},
},
};