Skip to content

ref(hybrid-cloud): Restrict notification settings UX to a single organization #50279

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 42 commits into from
Jul 17, 2023

Conversation

mikejihbe
Copy link
Contributor

Refactor the notification settings page to restrict viewing notification settings to a single organization. This is required to simplify some user notification setting APIs and make them compatible with hybrid cloud.

Currently the user notifications APIs return "virtual" notification settings for every project. This page doesn't really use those settings, it instead renders projects from the list of projects and merges in what gets returned. I think it should work fine if we only return actual notification settings records, which will allow us to simplify the user notification settings endpoints by removing these "virtual" entries -- assuming this was the only use case.

Issue_Alert_Notifications_—_Sentry

vbro and others added 5 commits May 18, 2023 09:19
@github-actions github-actions bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Jun 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 4, 2023

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

@codecov
Copy link

codecov bot commented Jun 5, 2023

Codecov Report

Merging #50279 (4de4c2a) into master (09ceea5) will increase coverage by 4.66%.
The diff coverage is 92.85%.

❗ Current head 4de4c2a differs from pull request most recent head d60066b. Consider uploading reports for the commit d60066b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #50279      +/-   ##
==========================================
+ Coverage   74.71%   79.37%   +4.66%     
==========================================
  Files        4901     4923      +22     
  Lines      206414   206690     +276     
  Branches    35296    35333      +37     
==========================================
+ Hits       154212   164068    +9856     
+ Misses      46936    37599    -9337     
+ Partials     5266     5023     -243     
Impacted Files Coverage Δ
...try/api/serializers/models/notification_setting.py 84.44% <ø> (ø)
src/sentry/models/integrations/external_actor.py 95.00% <ø> (ø)
src/sentry/models/notificationsetting.py 95.55% <ø> (ø)
src/sentry/notifications/helpers.py 93.41% <0.00%> (-1.91%) ⬇️
...settings/account/accountNotificationFineTuning.tsx 0.00% <ø> (ø)
...ngs/account/notifications/notificationSettings.tsx 78.26% <ø> (ø)
...tifications/notificationSettingsByOrganization.tsx 100.00% <ø> (ø)
...t/notifications/notificationSettingsByProjects.tsx 100.00% <ø> (ø)
...count/notifications/notificationSettingsByType.tsx 54.21% <ø> (+1.27%) ⬆️
...app/views/settings/account/notifications/utils.tsx 61.66% <ø> (ø)
... and 4 more

... and 701 files with indirect coverage changes

@mikejihbe mikejihbe marked this pull request as ready for review June 5, 2023 02:17
@mikejihbe mikejihbe requested a review from a team as a code owner June 5, 2023 02:17
Copy link
Contributor

@corps corps left a comment

Choose a reason for hiding this comment

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

Seems good, there is an issue with the component props.

@mikejihbe mikejihbe marked this pull request as ready for review July 5, 2023 01:47
team_providers = ExternalActor.objects.filter(
actor_id=recipient.actor_id, provider__in=possible_providers
).values_list("provider", flat=True)
return [get_provider_enum(provider) for provider in team_providers]
Copy link
Member

Choose a reason for hiding this comment

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

Was the team scenario never used? Looking at the call sites it looks like they are all User only.

const fineTuneType = getNotificationTypeFromPathname(pathnameType);
const endpoints = [
['notifications', '/users/me/notifications/'],
['fineTuneData', `/users/me/notifications/${fineTuneType}/`],
];

if (isGroupedByProject(fineTuneType)) {
endpoints.push(['projects', '/projects/']);
endpoints.push(['projects', `/projects/?organization_id=${orgId}`]);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
endpoints.push(['projects', `/projects/?organization_id=${orgId}`]);
endpoints.push(['projects', `/projects/?organizationId=${orgId}`]);

To go with the other casing change.

'projects',
`/projects/`,
{
query: {organization_id: this.props.organizationId},
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
query: {organization_id: this.props.organizationId},
query: {organizationId: this.props.organizationId},

To go with the other change.

{canSearch &&
this.renderSearchInput({
stateKey: 'projects',
url: `/projects/?organization_id=${this.props.organizationId}`,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
url: `/projects/?organization_id=${this.props.organizationId}`,
url: `/projects/?organizationId=${this.props.organizationId}`,

Comment on lines +65 to +66
// issue, quotaErrors, quotaTransactions, quotaAttachments,
// quotaReplays, quotaWarnings, quotaSpendAllocations
Copy link
Member

Choose a reason for hiding this comment

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

Are these cases that still need to be handled or cases where the default is ''?

Copy link
Contributor

Choose a reason for hiding this comment

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

The latter, I'll clarify


self.login_as(user=user, superuser=False)

response = self.get_success_response(qs_params={"organization_id": str(org.id)})
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
response = self.get_success_response(qs_params={"organization_id": str(org.id)})
response = self.get_success_response(qs_params={"organizationId": str(org.id)})

@corps corps merged commit aa870e3 into master Jul 17, 2023
@corps corps deleted the ihbe/notification-settings-ux branch July 17, 2023 16:50
@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants