diff --git a/framework/core/js/src/forum/components/UserSecurityPage.tsx b/framework/core/js/src/forum/components/UserSecurityPage.tsx index d0fdac8aa3..bb32f9f31f 100644 --- a/framework/core/js/src/forum/components/UserSecurityPage.tsx +++ b/framework/core/js/src/forum/components/UserSecurityPage.tsx @@ -51,17 +51,27 @@ export default class UserSecurityPage(); - ['developerTokens', 'sessions'].forEach((section) => { - const sectionName = `${section}Items` as 'developerTokensItems' | 'sessionsItems'; - const sectionLocale = camelCaseToSnakeCase(section); - + if ( + app.forum.attribute('canCreateAccessToken') || + app.forum.attribute('canModerateAccessTokens') || + (this.state.hasLoadedTokens() && this.state.getDeveloperTokens()?.length) + ) { items.add( - section, -
- {this[sectionName]().toArray()} + 'developerTokens', +
+ {this.developerTokensItems().toArray()}
); - }); + } else if (!this.state.hasLoadedTokens()) { + items.add('developerTokens', ); + } + + items.add( + 'sessions', +
+ {this.sessionsItems().toArray()} +
+ ); if (this.user!.id() === app.session.user!.id()) { items.add(