From ff73f116e85a05c4197bf7ddcc8b0cfc93c08802 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 4 May 2020 16:31:31 +0100 Subject: [PATCH] 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. --- app/assets/javascripts/discourse/app/helpers/raw.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/javascripts/discourse/app/helpers/raw.js b/app/assets/javascripts/discourse/app/helpers/raw.js index f1fb873927..0a764a1dee 100644 --- a/app/assets/javascripts/discourse/app/helpers/raw.js +++ b/app/assets/javascripts/discourse/app/helpers/raw.js @@ -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) {