backstage: the community link honors the community-button setting (#5909)

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 <bra1nz@astraoffice.com>
This commit is contained in:
Bra1nZandBra1nZ authored and GitHub committed 2026-11-08 01:56:04 +01:00
1 parent 746577406c
commit 4ce92e8afd
2 files changed
+31 -1

No files matched your search

+12 -1
View File
@@ -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() {
+19
View File
@@ -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]