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