클래스 목록 재정의

현재 커스텀 플러그인의 초기화 파일(initializer)에서 작업을 진행 중입니다. 각 잠긴(locked) 카테고리에 대해 임의의 클래스(locked-category)를 추가하고 싶은데, 어떻게 해야 할지 정확히 파악이 안 됩니다.

topic-list-item 템플릿을 편집할 수 있다는 점은 알고 있지만, 해당 클래스는 조건부이며, 해당 토픽이 잠겨 있는지에 따라 달라집니다.

해당 코드는 다음과 같습니다:
TopicStatus.reopen({ statuses(){ if (this.topic.is_locked_down) { // 토픽의 classList에 이 클래스를 추가하고 싶습니다 } ... })

혹시 아이디어가 있으신 분, 어떤 도움이라도 감사하겠습니다!

If

in your post refers to categories with limited read permissions then something like this will work if you add it to your initializer.

api.modifyClass("component:topic-list-item", {
  didInsertElement() {
    this._super(...arguments); // core 코드가 먼저 실행되도록 보장합니다

    const privateCategory = this.topic.category.read_restricted;
    if (privateCategory) {
      // 위의 조건을 충족하는 토픽 목록 항목에 클래스를 추가합니다
      this.element.classList.add("locked-category");
    }
  }
});

완벽해요, 작동하네요! 정말 감사합니다!