고정된 주제 분리하기

테이즈, 안녕하세요!

코드를 살펴봤는데, 거의 다 왔네요!

몇 가지 피드백을 드릴게요:

https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/components/topic-list/list.gjs#L126-L136

즉, 다음과 같이 작성해야 합니다:

export default class PinnedTopicBody extends Component {
  get pinnedTopics() {
    return this.outletArgs.topics.filter((t) => t.get("pinned"));
  }
}

그리고 템플릿은 다음과 같습니다:

{{#if this.pinnedTopics}}
  <tbody class="pinned-topics">
    {{#each this.pinnedTopics as |topic|}}
      <TopicListItem
        @topic={{topic}}
        @bulkSelectEnabled={{@outletArgs.bulkSelectEnabled}}
        @lastVisitedTopic={{@outletArgs.lastVisitedTopic}}
        @selected={{@outletArgs.selected}}
        @hideCategory={{@outletArgs.hideCategory}}
        @showPosters={{true}}
      />
    {{/each}}
    <tr class="table-break">
      <td colspan="10">&nbsp;</td>
    </tr>
  </tbody>
{{/if}}
import { classNames, tagName } from "@ember-decorators/component";

@tagName("tbody")
@classNames("pinned-topics")
export default class PinnedTopicBody extends Component {
  ...
}
{{#if this.pinnedTopics}}
  {{#each this.pinnedTopics as |topic|}}
    ...
  {{/each}}
  <tr class="table-break">
    <td colspan="10">&nbsp;</td>
  </tr>
{{/if}}

(요소에 아무것도 하지 않는다고 확신이 있다면, 템플릿에 tbody를 유지하고 tagName("")을 사용할 수 있습니다.)

그럼 이렇게 됩니다:

더 나은 방법이 있는지 철저히 검토하지는 않았습니다.
단순히 코드가 작동하도록 돕고 싶었을 뿐입니다! :smile: