From 2689ceb94c98cd9b4fb3ec8189ee191aded8a660 Mon Sep 17 00:00:00 2001 From: garammasala29 Date: Fri, 11 Feb 2022 16:19:38 +0900 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E8=AB=87=E9=83=A8=E5=B1=8B=E3=81=AE?= =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92Discord=E3=83=81?= =?UTF-8?q?=E3=83=A3=E3=83=83=E3=83=88=E3=81=AB=E9=80=9A=E7=9F=A5=E3=81=99?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/comment/after_create_callback.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/models/comment/after_create_callback.rb b/app/models/comment/after_create_callback.rb index ee771298ec5..eab7dc8f59f 100644 --- a/app/models/comment/after_create_callback.rb +++ b/app/models/comment/after_create_callback.rb @@ -11,6 +11,7 @@ def after_create(comment) if comment.commentable.instance_of?(Talk) notify_to_admins(comment) + notify_to_chat(comment) unless comment.sender.admin? update_unreplied(comment) end @@ -107,4 +108,12 @@ def update_unreplied(comment) unreplied = !comment.user.admin comment.commentable.update!(unreplied: unreplied) end + + def notify_to_chat(comment) + ChatNotifier.message(<<~TEXT, webhook_url: ENV['DISCORD_ADMIN_WEBHOOK_URL']) + 相談部屋にて#{comment.user.login_name}さんからコメントがありました。 + 本文: #{comment.description} + URL: https://bootcamp.fjord.jp/talks/#{comment.commentable_id} + TEXT + end end