로그에서 discourse-automation 플러그인이 PM을 보내지 못했다는 경고를 확인했습니다. 자동화 플러그인은 트리거가 실행되는 시점의 사용자 이름을 사용하며, PM 전송 시점의 최신 사용자 이름을 사용하지 않습니다. PM 전송 스크립트는 지연 전송을 지원하므로, 사용자가 트리거 발생 후 PM 전송 전에 사용자 이름을 변경할 경우 전송이 실패할 수 있습니다.
DiscourseAutomation::PendingPm이 사용자 이름 대신 사용자 ID를 기록하도록 변경하면 이 문제를 해결할 수 있다고 생각합니다:
# == Schema Information
#
# Table name: discourse_automation_pending_pms
#
# id :bigint not null, primary key
# execute_at :datetime not null
# raw :string
# sender :string
# target_usernames :string is an Array
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# automation_id :bigint not null
제 사용 사례에 대해 말씀드리면:
TL0 그룹에 가입한 후 5분 후 PM을 보내도록 자동화 플러그인을 설정하여,新用户에게 지연된 PM을 보내는 작업을 수행하고 있습니다. 하지만 일부 신규 사용자가 가입 직후 사용자 이름을 변경하여 전송이 실패하는 경우가 발생하고 있습니다.
2개의 좋아요
sam
(Sam Saffron)
2월 11, 2026, 6:04오전
2
놀라울 정도로 복잡한 미로로, 꽤 깊은 곳까지 이어집니다.
발굴을 마치고 나면, 우리가 PostCreator라고 부르는 근본적인 구조가 사용자 ID를 지원하지 않았다는 사실을 발견하게 됩니다.
main ← automation-lookup
merged 10:21PM - 11 Feb 26 UTC
Add `target_user_ids` as an alternative to `target_usernames` when
creating priv… ate messages via PostCreator and TopicCreator. The two
options are mutually exclusive and raise ArgumentError if both are
provided.
This avoids username-based lookups where the caller already has user
IDs, and prevents stale references when users rename after a pending
PM is created.
Key changes:
- PostCreator/TopicCreator: accept `target_user_ids`, validate
mutual exclusivity with `target_usernames`, extract shared
`add_users_from_scope` in TopicCreator
- Automation PendingPm: migrate from `sender`/`target_usernames`
string columns to `sender_id`/`target_user_ids` integer columns
with a backfill migration
- Scriptable::Utils.send_pm: resolve sender upfront, support
integer sender param, store IDs in pending PMs
모든 것이 훨씬 덜 의외의 결과를 낳게 되므로, 이는 훌륭한 변경 사항이라고 생각합니다. 사용자는 시작할 때 사용자 이름을 조금씩 바꾸는 경향이 있거든요.
3개의 좋아요