Skip to content

feat(notifications-v2): Read from notification settings for weekly reports #56621

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

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

snigdhas
Copy link
Member

Read from the new notifications tables for weekly reports instead of user options.

@snigdhas snigdhas requested a review from scefali September 20, 2023 22:31
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 20, 2023
@snigdhas snigdhas marked this pull request as ready for review September 20, 2023 22:47
@snigdhas snigdhas requested a review from a team as a code owner September 20, 2023 22:47
@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Merging #56621 (8fec2ac) into master (4a1c8ed) will decrease coverage by 0.01%.
Report is 14 commits behind head on master.
The diff coverage is 53.57%.

@@            Coverage Diff             @@
##           master   #56621      +/-   ##
==========================================
- Coverage   78.63%   78.63%   -0.01%     
==========================================
  Files        5083     5084       +1     
  Lines      219150   219178      +28     
  Branches    37102    37113      +11     
==========================================
+ Hits       172336   172343       +7     
- Misses      41230    41252      +22     
+ Partials     5584     5583       -1     
Files Changed Coverage
src/sentry/tasks/weekly_reports.py 46.15%
src/sentry/notifications/notificationcontroller.py 60.00%

@@ -553,3 +553,30 @@ def get_notification_provider_value_for_recipient_and_type(
return value

return NotificationSettingsOptionEnum.NEVER

def get_users_for_weekly_reports(self) -> list[int]:
Copy link
Contributor

Choose a reason for hiding this comment

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

@snigdhas Seems like we can use a combination of get_notification_value_for_recipient_and_type and get_notification_provider_value_for_recipient_and_type to make this logic super simple, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could, but we'd end up calling self._get_layered_setting_options N times for N users, and each call would do iterate over the entire dict. We could store the layered settings in memory instead of computing it but I'm not sure that's necessary

@snigdhas snigdhas merged commit dd417f1 into master Sep 21, 2023
@snigdhas snigdhas deleted the snigdha/notif-reports branch September 21, 2023 16:42
michellewzhang pushed a commit that referenced this pull request Sep 21, 2023
…ports (#56621)

Read from the new notifications tables for weekly reports instead of
user options.
@snigdhas snigdhas added this to the Notification Settings 2.0 milestone Sep 22, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants