DEV: Set owner on raw views (#9624)

This allows things like `Ember.inject.service` to be used within the raw view. setOwner simply sets one property on the object, and the result is cached along with the other injected properties, so this should have negligible performance impact.
This commit is contained in:
David Taylor 2020-05-04 16:31:31 +01:00 committed by GitHub
parent 3cce608379
commit ff73f116e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import { registerUnbound } from "discourse-common/lib/helpers";
import { findRawTemplate } from "discourse/lib/raw-templates";
import { htmlSafe } from "@ember/template";
import { setOwner } from "@ember/application";
let _injections;
@ -16,6 +17,7 @@ function renderRaw(ctx, container, template, templateName, params) {
session: container.lookup("session:main"),
topicTrackingState: container.lookup("topic-tracking-state:main")
};
setOwner(_injections, container);
}
if (!params.view) {