A platform for community discussion. Free, open, simple.
DEV: Expose before-link outlet in Horizon topic cards (#44779)
Mark VanLandingham0239cc37d34f
diff --git a/themes/horizon/javascripts/discourse/components/card/high-context-topic-card.gjs b/themes/horizon/javascripts/discourse/components/card/high-context-topic-card.gjsindex 16da9718aae..4176e285573 100644--- a/themes/horizon/javascripts/discourse/components/card/high-context-topic-card.gjs+++ b/themes/horizon/javascripts/discourse/components/card/high-context-topic-card.gjs@@ -191,6 +191,10 @@ export default class HighContextTopicCard extends Component {{{/if}}</span>{{/if}}+ <PluginOutlet+ @name="topic-list-before-link"+ @outletArgs={{lazyHash topic=@topic}}+ /></div></div>diff --git a/themes/horizon/test/acceptance/high-context-topic-card-test.gjs b/themes/horizon/test/acceptance/high-context-topic-card-test.gjsindex 57f64676a18..7eaf0ed1e88 100644--- a/themes/horizon/test/acceptance/high-context-topic-card-test.gjs+++ b/themes/horizon/test/acceptance/high-context-topic-card-test.gjs@@ -1,5 +1,6 @@import { render } from "@ember/test-helpers";import { module, test } from "qunit";+import { withPluginApi } from "discourse/lib/plugin-api";import Topic from "discourse/models/topic";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import HighContextTopicCard from "../../discourse/components/card/high-context-topic-card.gjs";@@ -36,6 +37,34 @@ module(function (hooks) {setupRenderingTest(hooks);+ test("renders before-link content with its topic outside the heading", async function (assert) {+ withPluginApi((api) => {+ api.renderInOutlet(+ "topic-list-before-link",+ <template>+ <span+ class="before-link-content"+ data-topic-id={{@outletArgs.topic.id}}+ >{{@outletArgs.topic.title}}</span>+ </template>+ );+ });+ const topic = topicFor();++ await render(+ <template>+ <HighContextTopicCard @hideCategory={{true}} @topic={{topic}} />+ </template>+ );++ assert+ .dom(".hc-topic-card__header .before-link-content")+ .hasText(topic.title)+ .hasAttribute("data-topic-id", String(topic.id));+ assert.dom(".hc-topic-card__title .before-link-content").doesNotExist();+ assert.dom(".hc-topic-card__title.raw-topic-link").hasText(topic.title);+ });+test("shows the last reply line with the actual reply time when a reply is recent", async function (assert) {const lastPostedAt = "2024-06-01T12:00:00Z";const topic = topicFor({