Commit b71c9803 by Hugo Häggmark Committed by Leonard Gram

fix: new team link goes nowhere for viewers

parent 53c74fa2
...@@ -92,7 +92,9 @@ export class TeamList extends PureComponent<Props, any> { ...@@ -92,7 +92,9 @@ export class TeamList extends PureComponent<Props, any> {
renderTeamList() { renderTeamList() {
const { teams, searchQuery, editorsCanAdmin, signedInUser } = this.props; const { teams, searchQuery, editorsCanAdmin, signedInUser } = this.props;
const disabledClass = editorsCanAdmin && signedInUser.orgRole === OrgRole.Viewer ? ' disabled' : ''; const isCanAdminAndViewer = editorsCanAdmin && signedInUser.orgRole === OrgRole.Viewer;
const disabledClass = isCanAdminAndViewer ? ' disabled' : '';
const newTeamHref = isCanAdminAndViewer ? '#' : 'org/teams/new';
return ( return (
<> <>
...@@ -109,7 +111,7 @@ export class TeamList extends PureComponent<Props, any> { ...@@ -109,7 +111,7 @@ export class TeamList extends PureComponent<Props, any> {
<div className="page-action-bar__spacer" /> <div className="page-action-bar__spacer" />
<a className={`btn btn-primary${disabledClass}`} href="org/teams/new"> <a className={`btn btn-primary${disabledClass}`} href={newTeamHref}>
New team New team
</a> </a>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment