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

ref(notifications): modify legacy option code #60437

Merged
merged 11 commits into from Nov 27, 2023

Conversation

scefali
Copy link
Member

@scefali scefali commented Nov 21, 2023

Before we did the changes for notification v2, we had a bunch of complicated mapping logic to map old options to NotificationSetting rows. It was very complicated and hard to understand. Now that we have migrated weekly reports to the new notification system and removed some complexity in the UI, we can remove a bunch of code. None of these endpoints are documented or used by APIs (purely used by the UI).

For UserNotificationDetailsEndpoint, now it only handles the legacy options of personalActivityNotifications and selfAssignOnResolve which are not true notification settings. In the future, we probably should handle them differently but for now, I'm making the endpoint a lot more simple by ripping out the code that tries to set NotificationSetting rows.

I also renamed UserNotificationFineTuningEndpoint to UserNotificationEmailEndpoint and ripped out all the non-email functionality. No more dependency on NotificationSetting at all.

Note, for some reason a bunch of tests broke that relied on a mocksentry.notifications.notify.notify. I think it had do with this change which I had to make because of some circular import problem that got exposed. Turns out we didn't need the mock at all so I just ripped it out.

@scefali scefali requested review from a team as code owners November 21, 2023 23:19
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 21, 2023
from sentry.types.integrations import ExternalProviders
from sentry.notifications.types import UserOptionsSettingsKey

USER_OPTION_SETTINGS = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this from legacy_mappings since it was the only thing left and this isn't used anywhere else

Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Merging #60437 (d3fe315) into master (f8ba0d6) will increase coverage by 1.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #60437      +/-   ##
==========================================
+ Coverage   79.81%   80.83%   +1.01%     
==========================================
  Files        5180     5179       -1     
  Lines      227644   227588      -56     
  Branches    38305    38296       -9     
==========================================
+ Hits       181702   183962    +2260     
+ Misses      40211    37996    -2215     
+ Partials     5731     5630     -101     
Files Coverage Δ
.../sentry/api/endpoints/user_notification_details.py 90.00% <100.00%> (-5.32%) ⬇️
...rc/sentry/api/endpoints/user_notification_email.py 100.00% <100.00%> (ø)
src/sentry/api/serializers/models/__init__.py 100.00% <ø> (ø)
src/sentry/api/urls.py 100.00% <100.00%> (ø)
src/sentry/notifications/types.py 98.40% <ø> (-1.60%) ⬇️
src/sentry/notifications/utils/__init__.py 74.78% <100.00%> (ø)
src/sentry/testutils/helpers/slack.py 85.93% <ø> (-0.83%) ⬇️

... and 197 files with indirect coverage changes

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 22, 2023
Copy link
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@@ -62,7 +62,7 @@ const patterns: RegExp[] = [
new RegExp('^api/0/users/[^/]+/ips/$'),
new RegExp('^api/0/users/[^/]+/notification-settings/$'),
new RegExp('^api/0/users/[^/]+/notifications/$'),
new RegExp('^api/0/users/[^/]+/notifications/[^/]+/$'),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need this change for tests to pass so I think I have to have this change

@scefali scefali merged commit 8299cd3 into master Nov 27, 2023
53 checks passed
@scefali scefali deleted the ref/remove-legacy-mapping-option-code branch November 27, 2023 16:17
@scefali scefali added the Trigger: Revert add to a merged PR to revert it (skips CI) label Nov 27, 2023
@getsentry-bot
Copy link
Contributor

PR reverted: bc271a9

getsentry-bot added a commit that referenced this pull request Nov 27, 2023
This reverts commit 8299cd3.

Co-authored-by: scefali <8533851+scefali@users.noreply.github.com>
@scefali scefali restored the ref/remove-legacy-mapping-option-code branch November 27, 2023 20:00
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components Trigger: Revert add to a merged PR to revert it (skips CI)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants