-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Feature : Added the feature of sending the notification of latest video/note to discord #601
Feature : Added the feature of sending the notification of latest video/note to discord #601
Conversation
Hey @hkirat , I have made the necessary changes you asked in live stream , and creating a new PR as the old one has some weird merge conflicts . I would request you to review this PR . |
can you add instruction and update .env.example on what do we need to setup the discord webhook url? Also solve the conflicts |
fdb6d4a
to
499d178
Compare
Done ⚡ |
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.
Please review the changes the requested and also can you add that if there is no webhook in the .env do not execute the request
src/app/services/DiscordService.tsx
Outdated
|
||
try { | ||
const res = await axios.post( | ||
`${process.env.NEXT_PUBLIC_DISCORD_WEBHOOK_URL}`, |
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.
This is being leaked on client site please move this login on server side
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.
done ser ✌
src/components/admin/AddContent.tsx
Outdated
|
||
const respData: { id: number } = await response.json(); | ||
|
||
const data = { |
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.
This is unnecessary here, do it server side here at /api/admin/content
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.
so @siinghd , do you want me to shift all of this logic to api/admin/content route and send checked variable in this request ?
const response = await fetch('/api/admin/content', {
body: JSON.stringify({
type,
description: '',
thumbnail: imageUri,
title,
courseId,
parentContentId,
metadata,
adminPassword,
}),
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});```
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.
Yes sir, also if no webhook env is set, do not send the dicord request
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.
Okay ser , understood . 🙌
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.
done ser ✌
@siinghd , you may check now . |
@siinghd sir ji , please look into this . |
@siinghd ? |
closing it as it has been merged to main via another PR |
Problem Statement
Currently, whenever a new video is uploaded into the CMS, Harkirat has to update the Discord community about it. This process requires additional effort after posting the video in the CMS.
Solution
I have implemented a solution where whenever a new video or note is added from the CMS admin panel, a notification for that video or note can be seen in Discord. I have made this an optional choice. If moderators want to add a video/note without sending a notification to discord, they can do so. Additionally , I have provided a checkbox for this purpose . Along with that in discord message you can even go to that particular video /note location by clicking the link provided there .
You can see the changes below :
2024-04-28.16-11-19.mp4
Checklist before requesting a review