https://github.com/discourse/discourse-assign에 기여하고 싶고, 주제에 해결책이 표시되면 해당 사용자를 할당 해제하는 기능을 추가하고 싶습니다. webhook.site를 사용하여 해결책이 표시된 테스트 주제를 감시하는 웹훅을 설정했지만, 주제가 닫힌 경우와 달리 응답 객체와 헤더가 달랐습니다.
아래 예시에서, 주제가 해결책이 있는 것으로 표시되었을 때 어떤 주제 상태를 찾아야 하나요?
on(:topic_status_updated) do |topic, status, enabled|
if SiteSetting.unassign_on_close && (status == "closed" || status == "autoclosed") && enabled &&
Assignment.exists?(topic_id: topic.id, active: true)
assigner = ::Assigner.new(topic, Discourse.system_user)
assigner.unassign(silent: true, deactivate: true)
topic
.posts
.joins(:assignment)
.find_each do |post|
assigner = ::Assigner.new(post, Discourse.system_user)
assigner.unassign(silent: true, deactivate: true)
end
MessageBus.publish("/topic/#{topic.id}", reload_topic: true, refresh_stream: true)
end
end