# 오래된 주제에 답글을 쓸 때 확인 상자 표시

**URL:** https://meta.discourse.org/t/add-confirmation-box-when-replying-to-old-topics/384483
**Category:** Development
**Created:** [10월 1, 2025, 6:27오후 UTC](https://meta.discourse.org/t/add-confirmation-box-when-replying-to-old-topics/384483 "2025-10-01T18:27:23Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![CT075](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ct075/32/375367_2.png) [@CT075](https://meta.discourse.org/u/CT075)
#### Post date: [10월 1, 2025, 6:27오후 UTC](https://meta.discourse.org/t/add-confirmation-box-when-replying-to-old-topics/384483/1 "2025-10-01T18:27:23Z")

</div>

(대부분 [Creating a component to show last-chance warning when replying to old topics](https://meta.discourse.org/t/last-chance-warning-when-replying-to-old-topics/382689) 에서 복사해옴)

저는 과거에 좀처럼 죽은 스레드를 되살리는(necro-bumping) 문제가 있었던 커뮤니티를 운영하고 있습니다.

저는 `warn_reviving_old_topic_age` (설정되어 있음)에 대해 _잘_ 알고 있지만, 많은 사용자가 경고 알림을 확인하지 못하는 것 같습니다. 또한, 오래된 스레드를 되살리는 것이 유용한 경우가 실제로 존재하기 때문에 전역적인 토픽 타이머를 도입하고 싶지도 않습니다.

이전 솔루션은 이 컴포넌트를 기반으로 한 “확실합니까?” 대화상자에서 게시를 차단하는 것이었습니다:

> [@Warn admins/tl4 when replying to closed topics](https://meta.discourse.org/t/warn-admins-tl4-when-replying-to-closed-topics/83912):
>
> [Admin Warnings Theme Component](https://github.com/davidtaylorhq/discourse-admin-warnings) https://github.com/davidtaylorhq/discourse-admin-warnings When admins click ‘reply’ on a closed topic, they will be warned. This helps to prevent admins accidentally continuing a closed/archived discussion (much to the frustration of other forum users!). Warning text is configurable and can be translated. To install, follow the instructions here:

하지만 해당 컴포넌트는 깨져 있다는 표시가 되어 있고(실제로 우리 버전도 깨져 있습니다). 원래 지원 요청에 대한 조언에 따라 [unformatted code detector](https://github.com/discourse/unformatted-code-detector/tree/main)를 살펴보기 시작했는데, 매우 유용했지만 마지막 단계를 넘어서지 못하고 있습니다.

현재 다음과 같은 코드를 작성했습니다:

```javascript
import { withPluginApi } from "discourse/lib/plugin-api";
import { inject as service } from "@ember/service";

export default {
  name: "discourse-necro-warnings",
  initialize() {
    withPluginApi("0.8.8", (api) => {
      api.modifyClass("service:composer", (Superclass) => class extends Superclass {
        save(...args) {
          let lastPostedAt = moment(this.model?.topic?.last_posted_at);
          let now = moment();
          let diff = now - lastPostedAt;
          console.log(diff)
          let d = moment.duration(settings.death_timer);

          if((diff >= d) && !skipWarning) {
            // TODO: i18n
            let diffH = moment.duration(diff).humanize();
            let confirmationMessage = `The last post in this thread was ${diffH} ago. Are you sure you want to bump this thread?`;
            this.dialog.yesNoConfirm({
              message: confirmationMessage,
              didConfirm: () => {
                super.save(...args)
              }
            });
          } else {
            super.save(...args);
          }
        }
      });
    });
  },
};

```

하지만 작동하지 않는 것 같습니다. 디버그 로그를 추가해 보니 `this.model?.topic?.last_posted_at`이 실제로 undefined인 것을 확인했고, 확인 대화상자가 작동하는지 여부도 알 수 없습니다.

조언을 주시면 감사하겠습니다. 토픽의 현재 뱀(bump) 날짜(있다면)의 ISO 문자열만 얻으면 진행할 수 있을 것 같습니다.

---

_[View the full topic](https://meta.discourse.org/t/add-confirmation-box-when-replying-to-old-topics/384483)._
