FIX: Allow reviewable-item components to be template-only (#19257)

The akismet plugin defines the `reviewable-akismet-post` component using a template under `discourse/templates/components/reviewable-akismet-post.hbs` without an associated `.js` file. The change to our resolution logic in c1397670 wasn't considering this.
This commit is contained in:
David Taylor 2022-11-30 12:55:12 +00:00 committed by GitHub
parent 99fa10eee6
commit 6969e9da7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -107,9 +107,10 @@ export default Component.extend({
}
const dasherized = dasherize(type);
const componentExists = getOwner(this).hasRegistration(
`component:${dasherized}`
);
const owner = getOwner(this);
const componentExists =
owner.hasRegistration(`component:${dasherized}`) ||
owner.hasRegistration(`template:components/${dasherized}`);
_components[type] = componentExists ? dasherized : null;
return _components[type];
},