Skip to content
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

Notification endpoints does not process bitfields #761

Open
tsa96 opened this issue Jun 23, 2023 · 0 comments
Open

Notification endpoints does not process bitfields #761

tsa96 opened this issue Jun 23, 2023 · 0 comments
Labels
Priority: High Should be done first and foremost, absolutely essential for this release. Size: Medium Something that may take a few days or so to implement. Type: Bug Something isn't working the way it should

Comments

@tsa96
Copy link
Member

tsa96 commented Jun 23, 2023

Old backend's method of doing updates to notifyOn values on MapNotify and is to batch all the flags into a bitfield where each ActivityType value x corresponds to the a 1 << x bit shift. It then stores that bitfield in DB, and genNotifications handles breaking down the field into flags.

This method seems fine to me, though we'll need to use a raw query for the DB stuff, since Prisma still doesn't support bitwise operations and given their bizarre prioritization decisions, probably won't for a long time. Maybe possible with Prisma Client Extensions? Don't really mind doing the raw query either way.

Actually supporting this is pretty much just a matter of changing the validators on relevant endpoints to allow values that aren't individual ActivityTypes, and do #760 so notifications actually get generated.

Ideally write a bunch more tests for notification-related behaviour. The old API had a couple of really complex E2E tests, we could do similar, e.g. submitting a map, it getting approved, someone following it, then someone submitting a run on it, checking it generates notifications. Could do as backend E2E, though if we wanna get really fancy, we could do in frontend E2E - honestly this sounds like the way to go.

@tsa96 tsa96 added Type: Bug Something isn't working the way it should Priority: High Should be done first and foremost, absolutely essential for this release. Size: Medium Something that may take a few days or so to implement. labels Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High Should be done first and foremost, absolutely essential for this release. Size: Medium Something that may take a few days or so to implement. Type: Bug Something isn't working the way it should
Projects
None yet
Development

No branches or pull requests

1 participant