Unify nav: merge Admin+Notifications into Dashboard, fold API Tokens into Profile

- Replace the separate Profile/API Tokens nav items with a single link
  showing the logged-in user's name, pointing at their own profile.
- Merge admin.ejs + notifications.ejs into a new dashboard.ejs page.
  /admin and /notifications now 301-redirect to /dashboard.
- Fold the API Tokens page into profile.ejs as a self-service-only
  section, gated on isOwnProfile so it never appears when an admin
  views another user's profile via /users/:uid. /api-tokens 301s to /.
- Fix: the section must not carry class="row" — app-base.js runs a
  page-wide $('div.row').fadeIn() on every page load that would reveal
  it regardless of the isOwnProfile check, since it fires before this
  page's own gating logic.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 23:42:28 -04:00
parent f45349e0cd
commit 2788dcd796
7 changed files with 622 additions and 624 deletions
+18 -25
View File
@@ -40,18 +40,6 @@
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav top-nav">
<li class="nav-item">
<a class="nav-link active" href="/">
<i class="fa-regular fa-id-card"></i>
Profile
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/api-tokens">
<i class="fa-solid fa-code"></i>
API Tokens
</a>
</li>
<li class="nav-item group-required group-required-app_sso_admin">
<a class="nav-link" href="/users"><i class="fa-solid fa-users"></i>
Users
@@ -75,19 +63,16 @@
</a>
</li>
<li class="nav-item group-required group-required-app_sso_admin">
<a class="nav-link" href="/notifications">
<i class="fa-solid fa-paper-plane"></i>
Notifications
</a>
</li>
<li class="nav-item group-required group-required-app_sso_admin">
<a class="nav-link" href="/admin">
<i class="fa-solid fa-screwdriver-wrench"></i>
Admin
<a class="nav-link" href="/dashboard">
<i class="fa-solid fa-gauge-high"></i>
Dashboard
</a>
</li>
</ul>
<div class="form-inline mt-2 mt-md-0">
<a id="cl-username" class="navbar-text text-light me-3" href="/" style="display: none;">
<i class="fa-solid fa-user me-1"></i><span id="cl-username-text"></span>
</a>
<a id="cl-login-button" class="btn btn-outline-danger my-2 my-sm-0" onclick="app.auth.forceLogin()" style="display: none;">
<i class="fas fa-sign-out"></i>
Login
@@ -112,10 +97,18 @@
}
})
// Set the correct login/logout button
if(await app.auth.isLoggedIn()) $('#cl-logout-button').show();
else $('#cl-login-button').show();
// Set the correct login/logout button, and reveal the current user's
// name (linking to their profile) once we know who they are.
var me = await app.auth.isLoggedIn();
if(me){
$('#cl-logout-button').show();
if(me.uid){
$('#cl-username-text').text(me.uid);
$('#cl-username').css('display', '');
}
}else{
$('#cl-login-button').show();
}
});
</script>