Skip to content

Commit 065fe65

Browse files
authored
feat(ui): Fix /settings/ when user is not part of any orgs (#90771)
This should fix [this issue](https://sentry.sentry.io/issues/4191022159/?project=11276&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D%20useOrganization&referrer=issue-stream&stream_index=1) as the `/settings/` index page can link to invalid URLs when user is not apart of any orgs. (I actually think this *only* is visitable when the user is not part of any orgs, otherwise it redirects you to org settings). Replace/remove all org links on this index page. Also fixes text clipping due to overflow + ellipsis (look at the "g" in Organization) Old: ![image](https://github.com/user-attachments/assets/83c0013b-4a91-40eb-bdbc-05473ac7127a) New: ![image](https://github.com/user-attachments/assets/2d246689-8735-467f-9461-6bdb48c9f9bd) Fixes JAVASCRIPT-2M6X
1 parent 5a14a38 commit 065fe65

File tree

1 file changed

+51
-46
lines changed

1 file changed

+51
-46
lines changed

static/app/views/settings/settingsIndex.tsx

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ function SettingsIndex(props: SettingsIndexProps) {
5353

5454
const supportLinkProps = {
5555
isSelfHosted,
56-
organizationSettingsUrl,
5756
};
5857

5958
// For the new navigation, we are removing this page. The default base route should
@@ -74,7 +73,7 @@ function SettingsIndex(props: SettingsIndexProps) {
7473
<HomePanelHeader>
7574
<HomeLinkIcon to="/settings/account/">
7675
<UserAvatar user={user} size={HOME_ICON_SIZE} />
77-
{t('My Account')}
76+
<HomeLinkLabel>{t('My Account')}</HomeLinkLabel>
7877
</HomeLinkIcon>
7978
</HomePanelHeader>
8079

@@ -102,35 +101,44 @@ function SettingsIndex(props: SettingsIndexProps) {
102101
const orgSettings = (
103102
<GridPanel>
104103
<HomePanelHeader>
105-
<HomeLinkIcon to={organizationSettingsUrl}>
106-
{organization ? (
104+
{organization ? (
105+
<HomeLinkIcon to={organizationSettingsUrl}>
107106
<OrganizationAvatar organization={organization} size={HOME_ICON_SIZE} />
108-
) : (
107+
<HomeLinkLabel>{organization.slug}</HomeLinkLabel>
108+
</HomeLinkIcon>
109+
) : (
110+
<HomeLinkIcon to="/organizations/new/">
109111
<HomeIconContainer color="green300">
110112
<IconStack size="lg" />
111113
</HomeIconContainer>
112-
)}
113-
<OrganizationName>
114-
{organization ? organization.slug : t('No Organization')}
115-
</OrganizationName>
116-
</HomeLinkIcon>
114+
<HomeLinkLabel>{t('Create an Organization')}</HomeLinkLabel>
115+
</HomeLinkIcon>
116+
)}
117117
</HomePanelHeader>
118118

119119
<HomePanelBody>
120120
<h3>{t('Quick links')}:</h3>
121-
<ul>
122-
<li>
123-
<HomeLink to={`${organizationSettingsUrl}projects/`}>
124-
{t('Projects')}
125-
</HomeLink>
126-
</li>
121+
{organization ? (
122+
<ul>
123+
<li>
124+
<HomeLink to={`${organizationSettingsUrl}projects/`}>
125+
{t('Projects')}
126+
</HomeLink>
127+
</li>
128+
<li>
129+
<HomeLink to={`${organizationSettingsUrl}teams/`}>{t('Teams')}</HomeLink>
130+
</li>
131+
<li>
132+
<HomeLink to={`${organizationSettingsUrl}members/`}>
133+
{t('Members')}
134+
</HomeLink>
135+
</li>
136+
</ul>
137+
) : (
127138
<li>
128-
<HomeLink to={`${organizationSettingsUrl}teams/`}>{t('Teams')}</HomeLink>
139+
<HomeLink to="/organizations/new/">{t('Create an organization')}</HomeLink>
129140
</li>
130-
<li>
131-
<HomeLink to={`${organizationSettingsUrl}members/`}>{t('Members')}</HomeLink>
132-
</li>
133-
</ul>
141+
)}
134142
</HomePanelBody>
135143
</GridPanel>
136144
);
@@ -142,7 +150,7 @@ function SettingsIndex(props: SettingsIndexProps) {
142150
<HomeIconContainer color="pink300">
143151
<IconDocs size="lg" />
144152
</HomeIconContainer>
145-
{t('Documentation')}
153+
<HomeLinkLabel>{t('Documentation')}</HomeLinkLabel>
146154
</ExternalHomeLinkIcon>
147155
</HomePanelHeader>
148156

@@ -176,7 +184,7 @@ function SettingsIndex(props: SettingsIndexProps) {
176184
<HomeIconContainer color="activeText">
177185
<IconSupport size="lg" />
178186
</HomeIconContainer>
179-
{t('Support')}
187+
<HomeLinkLabel>{t('Support')}</HomeLinkLabel>
180188
</SupportLink>
181189
</HomePanelHeader>
182190

@@ -210,26 +218,30 @@ function SettingsIndex(props: SettingsIndexProps) {
210218
<HomeIconContainer>
211219
<IconLock size="lg" locked />
212220
</HomeIconContainer>
213-
{t('API Keys')}
221+
<HomeLinkLabel>{t('API Keys')}</HomeLinkLabel>
214222
</HomeLinkIcon>
215223
</HomePanelHeader>
216224

217225
<HomePanelBody>
218226
<h3>{t('Quick links')}:</h3>
219227
<ul>
220-
<li>
221-
<HomeLink to={`${organizationSettingsUrl}auth-tokens/`}>
222-
{t('Organization Auth Tokens')}
223-
</HomeLink>
224-
</li>
228+
{organizationSettingsUrl && (
229+
<li>
230+
<HomeLink to={`${organizationSettingsUrl}auth-tokens/`}>
231+
{t('Organization Auth Tokens')}
232+
</HomeLink>
233+
</li>
234+
)}
225235
<li>
226236
<HomeLink to={LINKS.API}>{t('User Auth Tokens')}</HomeLink>
227237
</li>
228-
<li>
229-
<HomeLink to={`${organizationSettingsUrl}developer-settings/`}>
230-
{t('Custom Integrations')}
231-
</HomeLink>
232-
</li>
238+
{organizationSettingsUrl && (
239+
<li>
240+
<HomeLink to={`${organizationSettingsUrl}developer-settings/`}>
241+
{t('Custom Integrations')}
242+
</HomeLink>
243+
</li>
244+
)}
233245
<li>
234246
<ExternalHomeLink href={LINKS.DOCUMENTATION_API}>
235247
{t('Documentation')}
@@ -274,7 +286,7 @@ const HomePanelHeader = styled(PanelHeader)`
274286
font-size: ${p => p.theme.fontSizeExtraLarge};
275287
align-items: center;
276288
text-transform: unset;
277-
padding: ${space(4)};
289+
padding: ${space(4)} ${space(4)} 0;
278290
`;
279291

280292
const HomePanelBody = styled(PanelBody)`
@@ -342,27 +354,20 @@ const ExternalHomeLinkIcon = styled(ExternalLink)`
342354

343355
interface SupportLinkProps extends Omit<LinkProps, 'ref' | 'to'> {
344356
isSelfHosted: boolean;
345-
organizationSettingsUrl: string;
346357
icon?: boolean;
347358
}
348359

349-
function SupportLink({
350-
isSelfHosted,
351-
icon,
352-
organizationSettingsUrl,
353-
...props
354-
}: SupportLinkProps) {
360+
function SupportLink({isSelfHosted, icon, ...props}: SupportLinkProps) {
355361
if (isSelfHosted) {
356362
const SelfHostedLink = icon ? ExternalHomeLinkIcon : ExternalHomeLink;
357363
return <SelfHostedLink href={LINKS.FORUM} {...props} />;
358364
}
359365

360366
const SelfHostedLink = icon ? HomeLinkIcon : HomeLink;
361-
return <SelfHostedLink to={`${organizationSettingsUrl}support`} {...props} />;
367+
return <SelfHostedLink to="https://sentry.zendesk.com/hc/en-us" {...props} />;
362368
}
363369

364-
const OrganizationName = styled('div')`
365-
line-height: 1.1em;
366-
370+
const HomeLinkLabel = styled('div')`
371+
padding-bottom: ${space(4)};
367372
${p => p.theme.overflowEllipsis};
368373
`;

0 commit comments

Comments
 (0)