Skip to content

Commit

Permalink
卒業したユーザーをチャンネルに通知されるようにしました
Browse files Browse the repository at this point in the history
  • Loading branch information
kotakawase committed Oct 29, 2021
1 parent 87df638 commit 20a273a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/controllers/graduation_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def update
if @user.update(graduated_on: Date.current)
Subscription.new.destroy(@user.subscription_id) if @user.subscription_id

notify_to_chat(@user)
redirect_to admin_users_url, notice: 'ユーザー情報を更新しました。'
else
redirect_to admin_users_url, alert: 'ユーザー情報の更新に失敗しました'
Expand All @@ -18,4 +19,11 @@ def update
def set_user
@user = User.find(params[:user_id])
end

def notify_to_chat(user)
ChatNotifier.message(
"「#{user.login_name}さんが卒業になりました」",
webhook_url: ENV['DISCORD_TEST_WEBHOOK_URL']
)
end
end

0 comments on commit 20a273a

Please sign in to comment.