-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Changes from 8 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
d54060e
feat(hc): make NotificationSetting.target_id nullable
vbro f02200a
fix typing
vbro b9480e6
set fetch_actor=False in test_user_notification_settings
vbro a6f69ff
rebase and update migration
vbro 0a0d0f0
Refactor the notification settings page to restrict viewing notificat…
mikejihbe c7245ed
Fix up some FE tests
mikejihbe 416ca87
Merge branch 'master' into ihbe/notification-settings-ux
mikejihbe 02ddcaa
Fix up more notification fine tune settings UI
mikejihbe 5144248
Merge branch 'master' into ihbe/notification-settings-ux
mikejihbe 2bf272b
Fix up functionality. Styles are still a little borked
mikejihbe 5502823
Fix some bugs
mikejihbe dfd80a7
Fix styles
mikejihbe 1f625f0
cleanup
mikejihbe f3c92ea
Merge branch 'master' into ihbe/notification-settings-ux
mikejihbe 1009f4b
Merge branch 'master' into alter_notification_actor_nullable
mikejihbe ea0ad80
Add filter query implementation
mikejihbe accf98d
don't hash rpc notifications
mikejihbe 35653e2
Undo stable tests. This needs my other notification PR for that
mikejihbe f24e27d
Merge branch 'master' into alter_notification_actor_nullable
mikejihbe 20b8208
Add argument assertion
mikejihbe f98fe25
Factor actor id out of all notification updates
mikejihbe 06966f8
Merge branch 'master' into alter_notification_actor_nullable
mikejihbe aadddb9
Fix up some more callsites in tests
mikejihbe c2b9402
Fix what I hope is the last bug here
mikejihbe 37c79e1
:knife: regenerate mypy module blocklist
getsantry[bot] e96b605
More test fixes
mikejihbe 4227037
Fix final test
mikejihbe 8476518
Merge branch 'alter_notification_actor_nullable' into ihbe/notificati…
mikejihbe ecbffa1
Merge branch 'master' into ihbe/notification-settings-ux
mikejihbe 5e79b80
Fix types. And more tests
mikejihbe f973268
Merge branch 'master' into ihbe/notification-settings-ux
mikejihbe c973c3b
Fix team tests
mikejihbe ad82f05
Feedback
corps bca8f6c
Duplicate out new serializer backend
corps 7098000
Merge branch 'master' into ihbe/notification-settings-ux
corps 236e000
Tiny fixes
corps 3f22062
Fixes
corps ba88e43
More matcher fixes
corps 1aba6cc
Moo
corps 4de4c2a
Update static/app/views/settings/account/notifications/notificationSe…
corps d60066b
Merge branch 'master' into ihbe/notification-settings-ux
corps 6cea66c
Merge branch 'master' into ihbe/notification-settings-ux
corps File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -17,7 +17,9 @@ import { | |||||
ACCOUNT_NOTIFICATION_FIELDS, | ||||||
FineTuneField, | ||||||
} from 'sentry/views/settings/account/notifications/fields'; | ||||||
import NotificationSettingsByType from 'sentry/views/settings/account/notifications/notificationSettingsByType'; | ||||||
import NotificationSettingsByType, { | ||||||
OrganizationSelectHeader, | ||||||
} from 'sentry/views/settings/account/notifications/notificationSettingsByType'; | ||||||
import { | ||||||
getNotificationTypeFromPathname, | ||||||
groupByOrganization, | ||||||
|
@@ -69,7 +71,6 @@ function AccountNotificationsByProject({projects, field}: ANBPProps) { | |||||
<Fragment> | ||||||
{data.map(({name, projects: projectFields}) => ( | ||||||
<div key={name}> | ||||||
<PanelHeader>{name}</PanelHeader> | ||||||
{projectFields.map(f => ( | ||||||
<PanelBodyLineItem key={f.name}> | ||||||
<SelectField | ||||||
|
@@ -133,20 +134,33 @@ type State = AsyncView['state'] & { | |||||
emails: UserEmail[] | null; | ||||||
fineTuneData: Record<string, any> | null; | ||||||
notifications: Record<string, any> | null; | ||||||
organizationId: string; | ||||||
projects: Project[] | null; | ||||||
}; | ||||||
|
||||||
class AccountNotificationFineTuning extends AsyncView<Props, State> { | ||||||
getDefaultState() { | ||||||
return { | ||||||
...super.getDefaultState(), | ||||||
emails: [], | ||||||
fineTuneData: null, | ||||||
notifications: [], | ||||||
projects: [], | ||||||
organizationId: this.props.organizations[0].id, | ||||||
}; | ||||||
} | ||||||
|
||||||
getEndpoints(): ReturnType<AsyncView['getEndpoints']> { | ||||||
const {fineTuneType: pathnameType} = this.props.params; | ||||||
const orgId = this.state?.organizationId || this.props.organizations[0].id; | ||||||
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}`]); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
To go with the other casing change. |
||||||
} | ||||||
|
||||||
endpoints.push(['emails', '/users/me/emails/']); | ||||||
|
@@ -176,6 +190,14 @@ class AccountNotificationFineTuning extends AsyncView<Props, State> { | |||||
); | ||||||
} | ||||||
|
||||||
handleOrgChange = (option: {label: string; value: string}) => { | ||||||
this.setState({organizationId: option.value}); | ||||||
const self = this; | ||||||
setTimeout(() => { | ||||||
self.reloadData(); | ||||||
}, 0); | ||||||
}; | ||||||
|
||||||
renderBody() { | ||||||
const {params} = this.props; | ||||||
const {fineTuneType: pathnameType} = params; | ||||||
|
@@ -202,7 +224,6 @@ class AccountNotificationFineTuning extends AsyncView<Props, State> { | |||||
if (!notifications || !fineTuneData) { | ||||||
return null; | ||||||
} | ||||||
|
||||||
return ( | ||||||
<div> | ||||||
<SettingsPageHeader title={title} /> | ||||||
|
@@ -225,19 +246,25 @@ class AccountNotificationFineTuning extends AsyncView<Props, State> { | |||||
</Form> | ||||||
)} | ||||||
<Panel> | ||||||
<PanelHeader hasButtons={isProject}> | ||||||
{isProject ? ( | ||||||
<Fragment> | ||||||
<OrganizationSelectHeader | ||||||
organizations={this.props.organizations} | ||||||
organizationId={this.state.organizationId} | ||||||
handleOrgChange={this.handleOrgChange} | ||||||
/> | ||||||
{this.renderSearchInput({ | ||||||
placeholder: t('Search Projects'), | ||||||
url, | ||||||
stateKey, | ||||||
})} | ||||||
</Fragment> | ||||||
) : ( | ||||||
<Heading>{t('Organizations')}</Heading> | ||||||
)} | ||||||
</PanelHeader> | ||||||
<PanelBody> | ||||||
<PanelHeader hasButtons={isProject}> | ||||||
<Heading>{isProject ? t('Projects') : t('Organizations')}</Heading> | ||||||
<div> | ||||||
{isProject && | ||||||
this.renderSearchInput({ | ||||||
placeholder: t('Search Projects'), | ||||||
url, | ||||||
stateKey, | ||||||
})} | ||||||
</div> | ||||||
</PanelHeader> | ||||||
|
||||||
<Form | ||||||
saveOnBlur | ||||||
apiMethod="PUT" | ||||||
|
@@ -269,4 +296,4 @@ const Heading = styled('div')` | |||||
flex: 1; | ||||||
`; | ||||||
|
||||||
export default AccountNotificationFineTuning; | ||||||
export default withOrganizations(AccountNotificationFineTuning); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.