Northeastern-Electric-Racing / Northeastern-Electric-Racing/FinishLine

[Maintenance] - Allow Users to Turn Off Slack Notifications for Events

Open
#4,517 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

maintenance
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.

Image
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 sendSlackNotifications to both posts postCreateEvent and postEditEvent.
Proposed Solution
  • Add a state within EventModal.tsx called preferSlackNotifications and default it to whatever selectedEventType.sendSlackNotifications is. IF selectedEventType.sendSlackNotifications is FALSE, do not allow the user to turn it on. IF selectedEventType.sendSlackNotifications is TRUE, set preferSlackNotifications to true and allow them to switch it on/off.
  • Replace the areas of selectedEventType.sendSlackNotifications with 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 sendSlackNotifications to EventCreateArgs and EditEventArgs. createEvent in calendar.controller.ts and calendar.service.ts will need to take in this new sendSlackNotifications.
  • The schema for the Event model will need to change to include sendSlackNotifications as 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.