-
Notifications
You must be signed in to change notification settings - Fork 66
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
Improved Discord notifications #1826
Improved Discord notifications #1826
Conversation
getDiscordMessageUserIdString returns "<@[user.discordId]>" which mentions that discord user or "**[user.username]**" which shows user's c0d3 username in bold if their discord id is unavailable.
@JasirZaeem is attempting to deploy a commit to a Personal Account owned by @garageScript on Vercel. @garageScript first needs to authorize it. |
Update mock data to attempt to fix unexpected rejection in describe("Add comment resolver", ...)
Codecov Report
@@ Coverage Diff @@
## master #1826 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 161 163 +2
Lines 2751 2793 +42
Branches 732 745 +13
=========================================
+ Hits 2751 2793 +42
|
@@ -0,0 +1,178 @@ | |||
/** |
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.
NIT: space between the test cases and variables would make the code a little bit easier to go through.
const { author, submission } = comment | ||
|
||
if (author.id !== submission.user.id && submission.user.discordId) { | ||
const notificationEmbed: MessageEmbedOptions = { |
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.
Is it necessary to explicitly give it a type? TypeScript is capable of inferring its type and comparing the object's properties with sendDirectMessage
first parameter type.
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.
Yeah ts will figure out if the type is sufficient when this object is passed to the function, but I have explicitly typed the object literal as MessageEmbedOptions
to help with autocomplete and ides when reading/modifying the variable where it is declared.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
helpers/updateSubmission.ts
Outdated
if (user.discordId && reviewer) { | ||
const reviewerString = getDiscordMessageUserIdString(reviewer) | ||
const reviewNotificationEmbed: MessageEmbedOptions = { | ||
color: '#5440d8', |
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.
should this also be a constant?
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.
Yep, Done.
Followup to #949
Use discord ids of connected users to add and improve notifications
On challenge submission
On lesson completion
On receiving a star
On a comment on user's submission
Sent dm
![image](https://user-images.githubusercontent.com/20666236/166558191-85963b55-1adb-449c-b7f1-056618c63abb.png)
On acceptance/rejection of user's submission
Sent dm
![image](https://user-images.githubusercontent.com/20666236/166558763-c525b4b8-45d5-4767-8866-9a6734392e93.png)
![image](https://user-images.githubusercontent.com/20666236/166558882-d0717ac2-90db-4aaa-be4e-b41fbf49530d.png)
The title of the direct message is the reviewer's or commenter's name on c0d3.
![image](https://user-images.githubusercontent.com/20666236/166560846-0d1c2b80-1f95-45c0-a0b9-86f32249bc81.png)
The message either mentions the c0d3 user or discord username/nickname if their discord id is available, this let's other's easily know them on discord. The mention can also be clicked on to dm users.