FIX: Unescape emoji when pg headlines is used for search result blurb.

Follow-up to 8336c2235e
This commit is contained in:
Alan Guo Xiang Tan 2021-01-19 11:09:55 +08:00
parent 44f15d4281
commit 05e8c1ebf8
1 changed files with 6 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import RawHtml from "discourse/widgets/raw-html";
import { avatarImg } from "discourse/widgets/post"; import { avatarImg } from "discourse/widgets/post";
import { createWidget } from "discourse/widgets/widget"; import { createWidget } from "discourse/widgets/widget";
import { dateNode } from "discourse/helpers/node"; import { dateNode } from "discourse/helpers/node";
import { emojiUnescape } from "discourse/lib/text";
import { h } from "virtual-dom"; import { h } from "virtual-dom";
import highlightSearch from "discourse/lib/highlight-search"; import highlightSearch from "discourse/lib/highlight-search";
import { iconNode } from "discourse-common/lib/icon-library"; import { iconNode } from "discourse-common/lib/icon-library";
@ -153,7 +154,11 @@ createSearchResult({
{ attributes: { "data-topic-id": topic.id } }, { attributes: { "data-topic-id": topic.id } },
this.siteSettings.use_pg_headlines_for_excerpt && this.siteSettings.use_pg_headlines_for_excerpt &&
result.topic_title_headline result.topic_title_headline
? new RawHtml({ html: `<span>${result.topic_title_headline}</span>` }) ? new RawHtml({
html: `<span>${emojiUnescape(
result.topic_title_headline
)}</span>`,
})
: new Highlighted(topic.fancyTitle, term) : new Highlighted(topic.fancyTitle, term)
), ),
]; ];