From d570dc8a3a17bb8552916463ba84308bc4979032 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Tue, 4 Oct 2022 18:05:17 -0400 Subject: [PATCH] Send bot notice on GitHub OAuth success (#512) * Send bot notice on GitHub OAuth success i.e. the same as is done for Jira * Nitpick: don't backtick plain string message --- changelog.d/512.feature | 1 + src/Bridge.ts | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changelog.d/512.feature diff --git a/changelog.d/512.feature b/changelog.d/512.feature new file mode 100644 index 00000000..6dc4c438 --- /dev/null +++ b/changelog.d/512.feature @@ -0,0 +1 @@ +Print a notice message after successfully logging in to GitHub when conversing with the bot in a DM. diff --git a/src/Bridge.ts b/src/Bridge.ts index 9651a1e7..d0a1685a 100644 --- a/src/Bridge.ts +++ b/src/Bridge.ts @@ -420,6 +420,12 @@ export class Bridge { refresh_token: msg.data.refresh_token, refresh_token_expires_in: msg.data.refresh_token_expires_in && ((parseInt(msg.data.refresh_token_expires_in) * 1000) + Date.now()), } as GitHubOAuthToken)); + + // Some users won't have an admin room and would have gone through provisioning. + const adminRoom = [...this.adminRooms.values()].find(r => r.userId === userId); + if (adminRoom) { + await adminRoom.sendNotice("Logged into GitHub"); + } }); this.bindHandlerToQueue( @@ -535,7 +541,7 @@ export class Bridge { // Some users won't have an admin room and would have gone through provisioning. const adminRoom = [...this.adminRooms.values()].find(r => r.userId === userId); if (adminRoom) { - await adminRoom.sendNotice(`Logged into Jira`); + await adminRoom.sendNotice("Logged into Jira"); } result = JiraOAuthRequestResult.Success; } catch (ex) {