mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:50:00 +08:00
DEV: Set owner for raw views
Plugins/themes use injections in their raw view class. On recent versions of Ember these were failing with 'Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.'
This commit is contained in:
parent
a4c4d3cb50
commit
897de60330
|
@ -2,6 +2,7 @@ import { helperContext, registerUnbound } from "discourse-common/lib/helpers";
|
|||
import { findRawTemplate } from "discourse-common/lib/raw-templates";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
import { RUNTIME_OPTIONS } from "discourse-common/lib/raw-handlebars-helpers";
|
||||
import { getOwner, setOwner } from "@ember/application";
|
||||
|
||||
function renderRaw(ctx, template, templateName, params) {
|
||||
params = Object.assign({}, params);
|
||||
|
@ -13,6 +14,7 @@ function renderRaw(ctx, template, templateName, params) {
|
|||
|
||||
if (viewClass) {
|
||||
params.view = viewClass.create(params, context);
|
||||
setOwner(params.view, getOwner(context.site));
|
||||
}
|
||||
|
||||
if (!params.view) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user