DEV: Update final {{raw}} usages (#32082)

This commit is contained in:
David Taylor
2025-04-01 18:39:42 +01:00
committed by GitHub
parent 083082f328
commit c61b19e244
7 changed files with 23 additions and 26 deletions

View File

@ -14,6 +14,7 @@ import FlatButton from "discourse/components/flat-button";
import LoadMore from "discourse/components/load-more"; import LoadMore from "discourse/components/load-more";
import BookmarkModal from "discourse/components/modal/bookmark"; import BookmarkModal from "discourse/components/modal/bookmark";
import PluginOutlet from "discourse/components/plugin-outlet"; import PluginOutlet from "discourse/components/plugin-outlet";
import ActivityCell from "discourse/components/topic-list/item/activity-cell";
import TopicStatus from "discourse/components/topic-status"; import TopicStatus from "discourse/components/topic-status";
import avatar from "discourse/helpers/avatar"; import avatar from "discourse/helpers/avatar";
import categoryLink from "discourse/helpers/category-link"; import categoryLink from "discourse/helpers/category-link";
@ -22,7 +23,6 @@ import icon from "discourse/helpers/d-icon";
import discourseTags from "discourse/helpers/discourse-tags"; import discourseTags from "discourse/helpers/discourse-tags";
import formatDate from "discourse/helpers/format-date"; import formatDate from "discourse/helpers/format-date";
import htmlSafe from "discourse/helpers/html-safe"; import htmlSafe from "discourse/helpers/html-safe";
import raw from "discourse/helpers/raw";
import topicLink from "discourse/helpers/topic-link"; import topicLink from "discourse/helpers/topic-link";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { BookmarkFormData } from "discourse/lib/bookmark-form-data"; import { BookmarkFormData } from "discourse/lib/bookmark-form-data";
@ -401,12 +401,7 @@ export default class BookmarkList extends Component {
<td <td
class="post-metadata topic-list-data updated-at" class="post-metadata topic-list-data updated-at"
>{{formatDate bookmark.updated_at format="tiny"}}</td> >{{formatDate bookmark.updated_at format="tiny"}}</td>
{{raw <ActivityCell class="post-metadata" @topic={{bookmark}} />
"list/activity-column"
topic=bookmark
class="num post-metadata"
tagName="td"
}}
{{/if}} {{/if}}
<td class="topic-list-data"> <td class="topic-list-data">
<BookmarkActionsDropdown <BookmarkActionsDropdown

View File

@ -7,7 +7,7 @@ import {
import $ from "jquery"; import $ from "jquery";
import TopicPostBadges from "discourse/components/topic-post-badges"; import TopicPostBadges from "discourse/components/topic-post-badges";
import formatAge from "discourse/helpers/format-age"; import formatAge from "discourse/helpers/format-age";
import raw from "discourse/helpers/raw"; import TopicStatus from "./topic-status";
@classNameBindings(":featured-topic") @classNameBindings(":featured-topic")
@attributeBindings("topic.id:data-topic-id") @attributeBindings("topic.id:data-topic-id")
@ -23,7 +23,7 @@ export default class FeaturedTopic extends Component {
} }
<template> <template>
{{raw "topic-status" topic=this.topic}} <TopicStatus @topic={{this.topic}} @disableActions={{true}} />
<a href={{this.topic.lastUnreadUrl}} class="title">{{htmlSafe <a href={{this.topic.lastUnreadUrl}} class="title">{{htmlSafe
this.topic.fancyTitle this.topic.fancyTitle
}}</a> }}</a>

View File

@ -5,18 +5,19 @@ import {
classNameBindings, classNameBindings,
} from "@ember-decorators/component"; } from "@ember-decorators/component";
import PluginOutlet from "discourse/components/plugin-outlet"; import PluginOutlet from "discourse/components/plugin-outlet";
import ItemRepliesCell from "discourse/components/topic-list/item/replies-cell";
import { import {
navigateToTopic, navigateToTopic,
showEntrance, showEntrance,
} from "discourse/components/topic-list-item"; } from "discourse/components/topic-list-item";
import TopicPostBadges from "discourse/components/topic-post-badges"; import TopicPostBadges from "discourse/components/topic-post-badges";
import TopicStatus from "discourse/components/topic-status";
import UserAvatarFlair from "discourse/components/user-avatar-flair"; import UserAvatarFlair from "discourse/components/user-avatar-flair";
import UserLink from "discourse/components/user-link"; import UserLink from "discourse/components/user-link";
import avatar from "discourse/helpers/avatar"; import avatar from "discourse/helpers/avatar";
import categoryLink from "discourse/helpers/category-link"; import categoryLink from "discourse/helpers/category-link";
import discourseTags from "discourse/helpers/discourse-tags"; import discourseTags from "discourse/helpers/discourse-tags";
import formatDate from "discourse/helpers/format-date"; import formatDate from "discourse/helpers/format-date";
import raw from "discourse/helpers/raw";
import topicFeaturedLink from "discourse/helpers/topic-featured-link"; import topicFeaturedLink from "discourse/helpers/topic-featured-link";
import topicLink from "discourse/helpers/topic-link"; import topicLink from "discourse/helpers/topic-link";
import discourseComputed from "discourse/lib/decorators"; import discourseComputed from "discourse/lib/decorators";
@ -85,7 +86,7 @@ export default class LatestTopicListItem extends Component {
</div> </div>
<div class="main-link"> <div class="main-link">
<div class="top-row"> <div class="top-row">
{{raw "topic-status" topic=this.topic}} <TopicStatus @topic={{this.topic}} />
{{topicLink this.topic}} {{topicLink this.topic}}
{{~#if this.topic.featured_link}} {{~#if this.topic.featured_link}}
&nbsp;{{topicFeaturedLink this.topic}} &nbsp;{{topicFeaturedLink this.topic}}
@ -114,7 +115,7 @@ export default class LatestTopicListItem extends Component {
@connectorTagName="div" @connectorTagName="div"
@outletArgs={{hash topic=this.topic}} @outletArgs={{hash topic=this.topic}}
/> />
{{raw "list/posts-count-column" topic=this.topic tagName="div"}} <ItemRepliesCell @topic={{this.topic}} @tagName="div" />
<div class="topic-last-activity"> <div class="topic-last-activity">
<a <a
href={{this.topic.lastPostUrl}} href={{this.topic.lastPostUrl}}

View File

@ -1,9 +1,10 @@
import Component from "@ember/component"; import Component from "@ember/component";
import { classNameBindings, tagName } from "@ember-decorators/component"; import { classNameBindings, tagName } from "@ember-decorators/component";
import PostCountOrBadges from "discourse/components/topic-list/post-count-or-badges";
import { showEntrance } from "discourse/components/topic-list-item"; import { showEntrance } from "discourse/components/topic-list-item";
import TopicStatus from "discourse/components/topic-status";
import coldAgeClass from "discourse/helpers/cold-age-class"; import coldAgeClass from "discourse/helpers/cold-age-class";
import formatAge from "discourse/helpers/format-age"; import formatAge from "discourse/helpers/format-age";
import raw from "discourse/helpers/raw";
import rawDate from "discourse/helpers/raw-date"; import rawDate from "discourse/helpers/raw-date";
import topicLink from "discourse/helpers/topic-link"; import topicLink from "discourse/helpers/topic-link";
@ -15,7 +16,7 @@ export default class MobileCategoryTopic extends Component {
<template> <template>
<td class="main-link"> <td class="main-link">
<div class="topic-inset"> <div class="topic-inset">
{{raw "topic-status" topic=this.topic}} <TopicStatus @topic={{this.topic}} @disableActions={{true}} />
{{topicLink this.topic}} {{topicLink this.topic}}
{{#if this.topic.unseen}} {{#if this.topic.unseen}}
<span class="badge-notification new-topic"></span> <span class="badge-notification new-topic"></span>
@ -26,10 +27,8 @@ export default class MobileCategoryTopic extends Component {
>{{formatAge this.topic.last_posted_at}}</span> >{{formatAge this.topic.last_posted_at}}</span>
</div> </div>
</td> </td>
<td class="num posts">{{raw <td class="num posts">
"list/post-count-or-badges" <PostCountOrBadges @topic={{this.topic}} @postBadgesEnabled={{true}} />
topic=this.topic </td>
postBadgesEnabled="true"
}}</td>
</template> </template>
} }

View File

@ -11,13 +11,13 @@ import {
} from "@ember-decorators/component"; } from "@ember-decorators/component";
import HighlightSearch from "discourse/components/highlight-search"; import HighlightSearch from "discourse/components/highlight-search";
import PluginOutlet from "discourse/components/plugin-outlet"; import PluginOutlet from "discourse/components/plugin-outlet";
import TopicStatus from "discourse/components/topic-status";
import TrackSelected from "discourse/components/track-selected"; import TrackSelected from "discourse/components/track-selected";
import avatar from "discourse/helpers/avatar"; import avatar from "discourse/helpers/avatar";
import categoryLink from "discourse/helpers/category-link"; import categoryLink from "discourse/helpers/category-link";
import icon from "discourse/helpers/d-icon"; import icon from "discourse/helpers/d-icon";
import discourseTags from "discourse/helpers/discourse-tags"; import discourseTags from "discourse/helpers/discourse-tags";
import formatDate from "discourse/helpers/format-date"; import formatDate from "discourse/helpers/format-date";
import raw from "discourse/helpers/raw";
import { wantsNewWindow } from "discourse/lib/intercept-click"; import { wantsNewWindow } from "discourse/lib/intercept-click";
import { logSearchLinkClick } from "discourse/lib/search"; import { logSearchLinkClick } from "discourse/lib/search";
@ -75,11 +75,12 @@ export default class SearchResultEntry extends Component {
role="heading" role="heading"
aria-level="2" aria-level="2"
> >
{{raw <TopicStatus
"topic-status" @topic={{this.post.topic}}
topic=this.post.topic @disableActions={{true}}
showPrivateMessageIcon=true @showPrivateMessageIcon={{true}}
}} />
<span class="topic-title"> <span class="topic-title">
{{#if this.post.useTopicTitleHeadline}} {{#if this.post.useTopicTitleHeadline}}
{{htmlSafe this.post.topicTitleHeadline}} {{htmlSafe this.post.topicTitleHeadline}}

View File

@ -12,6 +12,7 @@ const ActivityCell = <template>
"activity num topic-list-data" "activity num topic-list-data"
(coldAgeClass @topic.createdAt startDate=@topic.bumpedAt class="") (coldAgeClass @topic.createdAt startDate=@topic.bumpedAt class="")
}} }}
...attributes
> >
<a href={{@topic.lastPostUrl}} class="post-activity"> <a href={{@topic.lastPostUrl}} class="post-activity">
{{~! no whitespace ~}} {{~! no whitespace ~}}

View File

@ -126,7 +126,7 @@ acceptance("Search - Full Page", function (needs) {
assert.dom(".fps-topic").exists({ count: 1 }, "has one post"); assert.dom(".fps-topic").exists({ count: 1 }, "has one post");
assert assert
.dom(".topic-status .personal_message") .dom(".topic-status .d-icon-envelope")
.exists({ count: 1 }, "shows the right icon"); .exists({ count: 1 }, "shows the right icon");
assert assert