From 71c4130d42ca9963a864c8685aa628a41939ac42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 5 Sep 2026 00:04:00 +0300 Subject: [PATCH] feat(ui): profile link to im in the user menu, settings leaves the nav MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The topbar nav is Drive/Shared/Trash/Search again — settings lives in the user menu, beside a new Profile item that leads to the issuer's account page (identity is im's surface, so the profile link crosses over with data-hard). --- crates/in-web/src/layout.rs | 14 ++++++-------- crates/in-web/tests/http.rs | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/crates/in-web/src/layout.rs b/crates/in-web/src/layout.rs index b55a4fa..2c9235b 100644 --- a/crates/in-web/src/layout.rs +++ b/crates/in-web/src/layout.rs @@ -21,7 +21,7 @@ use topcoat::{ use in_core::store::User; use crate::i18n::{Key, Lang, t}; -use crate::server::current_user; +use crate::server::{app, current_user}; /// The In monogram again, as the tab icon: the same drawing as `mark`, /// inlined because it must carry its own colours — a data URI has no page to @@ -124,6 +124,7 @@ pub async fn user_menu(cx: &Cx, user: &User, lang: Lang) -> Result { if user.admin {
(t(lang, Key::AdminBadge))
} + (t(lang, Key::Profile)) (t(lang, Key::NavSettings)) (t(lang, Key::SignOut)) @@ -142,13 +143,10 @@ pub enum NavPage { } impl NavPage { - const ALL: [Self; 5] = [ - Self::Drive, - Self::Shared, - Self::Trash, - Self::Search, - Self::Settings, - ]; + /// Settings is deliberately absent: it lives in the user menu, not the + /// page nav — the variant stays so the settings page can still name + /// itself active without a link to mark. + const ALL: [Self; 4] = [Self::Drive, Self::Shared, Self::Trash, Self::Search]; fn href(self) -> &'static str { match self { diff --git a/crates/in-web/tests/http.rs b/crates/in-web/tests/http.rs index 3b5498f..bd1d6e2 100644 --- a/crates/in-web/tests/http.rs +++ b/crates/in-web/tests/http.rs @@ -2266,3 +2266,25 @@ async fn settings_quota_button_wears_the_quiet_class() { let form_end = body[quota_at..].find("").expect("quota form never closes"); assert!(button_at < form_end, "quiet button escapes the quota form: {body}"); } + +#[tokio::test] +async fn settings_lives_in_the_user_menu_not_the_topbar() { + let app = TestApp::build().await; + let cookie = app.sign_in("sub-menu", "menu@in.test", "Menu").await; + let page = app.get("/drive", Some(&cookie)).await; + assert_eq!(page.status, StatusCode::OK, "{}", page.text()); + let body = page.text(); + + // The page nav carries no settings link… + let nav_start = body.find("topbar-nav-links").expect("no nav"); + let nav_end = body[nav_start..].find("").expect("nav never closes"); + let nav = &body[nav_start..nav_start + nav_end]; + assert!(!nav.contains("/settings"), "settings leaked into the nav: {nav}"); + + // …the user menu carries it, plus the profile link out to im. + let menu_start = body.find("user-menu-panel").expect("no user menu"); + let menu = &body[menu_start..]; + assert!(menu.contains("href=\"/settings\""), "{menu}"); + let issuer = format!("href=\"{}/\"", app.config.oidc.issuer); + assert!(menu.contains(&issuer), "no profile link to the issuer: {menu}"); +}