Northeastern-Electric-Racing / Northeastern-Electric-Racing/FinishLine
[Maintenance] - Allow Users to Turn Off Slack Notifications for Events
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 36
- Forks
- 9
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 11
Description
Description
Users should be able to turn off slack notifications for events.
Acceptance Criteria
- When the bell is clicked, the slack notification should turn to "Off"
- When the event is submitted, the EventPayload should send an override
sendSlackNotificationsto both postspostCreateEventandpostEditEvent.
Proposed Solution
- Add a state within
EventModal.tsxcalled preferSlackNotifications and default it to whateverselectedEventType.sendSlackNotificationsis. IFselectedEventType.sendSlackNotificationsis FALSE, do not allow the user to turn it on. IFselectedEventType.sendSlackNotificationsis TRUE, set preferSlackNotifications to true and allow them to switch it on/off. - Replace the areas of
selectedEventType.sendSlackNotificationswith preferSlackNotifications so that all states update when you click the bell.
So
{selectedEventType.sendSlackNotifications ? 'On' : 'Off'}
turns into:
{preferSlackNotifications ? 'On' : 'Off'}
- You will need to add in
sendSlackNotificationstoEventCreateArgsandEditEventArgs.createEventincalendar.controller.tsandcalendar.service.tswill need to take in this newsendSlackNotifications. - The schema for the Event model will need to change to include
sendSlackNotificationsas part of the model. - In
notifications.service.ts, when the events are grabbed:
const events = await prisma.event.findMany({
where: {
status: 'SCHEDULED',
dateDeleted: null,
scheduledTimes: {
some: {
AND: [{ endTime: { gte: startOfToday } }, { startTime: { lte: endOfToday } }]
}
},
eventType: {
sendSlackNotifications: true
}
},
//...
- There should be a check for sendSlackNotifications:
const events = await prisma.event.findMany({
where: {
status: 'SCHEDULED',
dateDeleted: null,
scheduledTimes: {
some: {
AND: [{ endTime: { gte: startOfToday } }, { startTime: { lte: endOfToday } }]
}
},
sendSlackNotifications: true,
eventType: {
sendSlackNotifications: true
}
},
//...
- This works because by default sendSlackNotifications will be true for all events except if explicitly turned off to false. In that case, it will skip that event.
Mocks
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with EventModal.tsx and trace EventCreateArgs and EditEventArgs through calendar.controller.ts and calendar.service.ts. Then inspect the Event schema and notifications.service.ts to understand where the per-event setting is stored and queried. Done means the bell can disable Slack notifications for an event, both event mutations accept the override, and scheduled notifications skip disabled events.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design, databases, full-stack
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100