From 4ce92e8afddf882f51465d5a67a5654afc60d27a Mon Sep 17 00:00:00 2001 From: Bra1nZ <95569966+Bra1nZ@users.noreply.github.com> Date: Sun, 8 Nov 2026 03:56:04 +0300 Subject: [PATCH] backstage: the community link honors the community-button setting (#5909) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit File › Options' "Show the community button in the title bar" hid only the title-bar pill; the backstage menu still showed "Discord community" at its bottom — one setting, half honored. The menu now draws the link only when the same setting is on, next to About. Co-authored-by: Bra1nZ --- crates/ui-egui/src/backstage.rs | 13 ++++++++++++- crates/ui-egui/src/tests.rs | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/backstage.rs b/crates/ui-egui/src/backstage.rs index a1605c66a4..d3fd4a4ccc 100644 --- a/crates/ui-egui/src/backstage.rs +++ b/crates/ui-egui/src/backstage.rs @@ -55,6 +55,17 @@ fn back_chevron_c(band_min_x: f32, center_y: f32, fullscreen: bool, content_left pos2(band_min_x + x, center_y) } +/// The bottom of the backstage menu: About, and the community link unless the user turned the +/// community button off — the title bar pill honors the same setting, so the menu hides the +/// link with it. +fn bottom_links(app: &WordApp) -> Vec<(&'static str, &'static str)> { + let mut links = vec![("About", "about")]; + if app.ui.show_discord { + links.push(("Discord community", "discord")); + } + links +} + /// Draws the Backstage side menu and the active page. Without a document only the Home, New, Open /// and Options pages work, and it handles Back, Escape, Save, Save As and Close routing. pub fn show(app: &mut WordApp, ui: &mut Ui) { @@ -155,7 +166,7 @@ pub fn show(app: &mut WordApp, ui: &mut Ui) { } } ui.with_layout(egui::Layout::bottom_up(egui::Align::Min), |ui| { - for (label, id) in [("About", "about"), ("Discord community", "discord")] { + for (label, id) in bottom_links(app) { let (r, resp) = ui.allocate_exact_size(vec2(200.0, 32.0), Sense::click()); resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), tl!(label))); if resp.hovered() { diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index c8103b6e6b..32136193d2 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -590,6 +590,25 @@ fn title_and_account_buttons_work() { assert!(h.query_by_label("User name:").is_some()); } +/// The Options toggle hides the community pill in the title bar; the backstage menu's +/// Discord link hides with it — one setting, everywhere the link shows. +#[test] +fn the_community_button_off_hides_the_backstage_discord_link_too() { + use egui_kittest::kittest::Queryable; + let mut a = app(); + a.run("ui.backstage", json!({"value": true})).unwrap(); + let mut h = harness(a); + h.run_steps(2); + assert!(h.query_by_label("Discord community").is_some(), "the community link shows by default"); + + let mut a = app(); + a.ui.show_discord = false; + a.run("ui.backstage", json!({"value": true})).unwrap(); + let mut h = harness(a); + h.run_steps(2); + assert!(h.query_by_label("Discord community").is_none(), "the backstage link honors the same setting"); +} + /// File › Options › Advanced › Editing: alignment guides are a UI command, on by default and /// kept between runs. #[test]