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


(Acshi Haggenmiller) #1

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.

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?


(Robin Ward) #2

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


(Robin Ward) #3

This commit should fix it:

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


Important changes to Plugin Outlets for Ember 2.10
Discourse Voting
(Jeff Atwood) #4