-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
提出物の最終コメントが5日経過したことを知らせる通知のメンション部分が空になってしまうバグを修正 #8218
base: main
Are you sure you want to change the base?
Conversation
@Judeeeee |
お疲れ様です!依頼いただきありがとうございます〜! |
@Judeeeee |
@ai-24 |
@hagiya0121 さん |
@ai-24 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hagiya0121 さん
お疲れ様です!
大変お待たせいたしました🙇♀️
変更確認方法、詳しく教えて頂きありがとうございました🙏
おかげでスムーズに見させていただけました!
しっかりメンションも飛んでいるので問題ないかと思います。
私からはApproveさせていただきます〜
@ai-24 |
@komagata |
@okuramasafumi こちらレビューお願い致します〜 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discord連携されていないケースで、product_checker_name
がnil
になることがありそうです。
bootcamp/app/models/discord/server.rb
Line 73 in 9db2507
target_member = guild_members.select { |member| member['user']['username'] == member_name } |
の
member_name
がnil
でも問題はなさそうですが、念のため書いておきます(最初に問題ではと思ったけど、調べたら大丈夫そうだった、というお話)。
お疲れ様でした!
Issue
概要
提出物の担当をしてるメンターに送られる、提出物の最終コメントが5日経過したことを知らせる通知があります。
通知のメンション部分には担当しているメンターの名前が入るはずですが、それが空になってしまうバグを修正しました。
※issueだと3日経過なのですが、その変更のPRはまだマージされてないです。
原因
Discord上でメンションをするためにDiscordユーザーIDが必要なのですが、Usersテーブルのlogin_nameとDiscordのユーザー名が一致しない場合にDiscordのユーザーIDを取得できず、メンションが空になっていました。
対処
login_nameだとDiscord上の名前と必ずしも一致しないので使うのをやめてDiscordProfilsテーブルにあるaccount_nameを使うことにしました。
変更確認方法
事前準備
環境変数としてDiscordの
サーバーID
、ウェブフックURL
、Discord Botトークン
が必要です。ウェブフックURL
を用意しますDiscordrb::Errors::NoPermission in Scheduler::Daily::NotifyProductReviewNotCompletedController#show
というエラーが出てしまいます。動作確認
bug/discord-notification-empty-mention
をローカルに取り込むgit fetch origin pull/8218/head:bug/discord-notification-empty-mention
git checkout bug/discord-notification-empty-mention
環境変数を含めてローカルサーバーを立ち上げる
DISCORD_GUILD_ID=<サーバーID> DISCORD_MENTOR_WEBHOOK_URL=<ウェブフックURL> DISCORD_BOT_TOKEN=<Discord Botトークン> TOKEN=token foreman start -f Procfile.dev
komagata
(メンター)でログイン提出物のページにアクセスして
担当する
を押すkensyu
(提出した人)でログイン提出物のページにアクセスしてコメントする
Discord 通知イベントを発生させるために下記を実行して DB を更新する
rails c
を実行自分のDiscordユーザー名を登録する
rails c
を実行http://localhost:3000/scheduler/daily/notify_product_review_not_completed?token=token&webhook_url=<ウェブフックURL>
にアクセスしてDiscordに自分がメンションされた通知が送られることを確認Screenshot
変更前
変更後