Raw plugin outlets not looking in RAW_TEMPLATES in v1.7.0.beta11

I have a raw template in my plugin at assets\javascripts\discourse\templates\connectors\topic-list-tags\template.raw.hbs that is not being inserted into the topic list.

Looking at the new code:
A raw plugin outlet uses connectorsFor to find relevant templates.

https://github.com/discourse/discourse/blob/v1.7.0.beta11/app/assets/javascripts/discourse/helpers/raw-plugin-outlet.js.es6

But since connectorsFor just looks in the _connectorCache which is only populated from Ember.TEMPLATES and not from Discourse.RAW_TEMPLATES, it can’t find my template.raw.hbs file.

function buildConnectorCache() {
  _connectorCache = {};

  findOutlets(Ember.TEMPLATES, function(outletName, resource, uniqueName) {
    _connectorCache[outletName] = _connectorCache[outletName] || [];

    _connectorCache[outletName].push({
      templateName: resource.replace('javascripts/', ''),
      template: Ember.TEMPLATES[resource],
      classNames: `${outletName}-outlet ${uniqueName}`,
      connectorClass: findClass(outletName, uniqueName)
    });
  });
}

export function connectorsFor(outletName) {
  if (!_connectorCache) { buildConnectorCache(); }
  return _connectorCache[outletName] || [];
}

How should this be fixed or am I missing something?

2 Likes

Thanks for reporting it. It looks like this slipped through despite me reviewing MANY plugins. I’m working on a fix now.

4 Likes

This commit should fix it:

https://github.com/discourse/discourse/commit/7c8095294d7296f0f27d4cb4066f1555fc8c2cbc

I’ve also included a test to avoid this happening again.

6 Likes