Toolbar flyout: a failed Edit Toolbar… reports its error in the status bar (#11378)

The flyout row discarded the result of edit.toolbar, so a rejected command (for example by an automation policy) just closed the flyout silently. It now sets the status bar error like other panels.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Trevor BrownandClaude Fable 5.1 committed 2026-11-06 09:47:35 -05:00
1 parent e5e7848143
commit 665170d1f8
2 files changed
+22 -1

No files matched your search

+4 -1
View File
@@ -128,7 +128,10 @@ fn more_slot_flyout(app: &mut PhotocraftApp, ui: &mut egui::Ui, button: &egui::R
if area.inner.inner {
ui.data_mut(|d| d.remove::<bool>(open_id));
let ctx = ui.ctx().clone();
let _ = crate::menus::invoke(app, &ctx, "edit.toolbar", json!({}));
if let Err(e) = crate::menus::invoke(app, &ctx, "edit.toolbar", json!({})) {
app.ui.status = e;
app.ui.status_error = true;
}
return;
}
let pressed_outside =
@@ -105,3 +105,21 @@ fn a_left_click_still_opens_edit_toolbar_directly() {
assert_eq!(app.ui.dialogs.len(), 1);
assert!(!open(&ctx), "no flyout for a left click");
}
#[test]
fn a_failed_edit_toolbar_from_the_flyout_reports_its_error_in_the_status_bar() {
let (mut app, ctx, at) = setup();
app.automation_input = true;
app.services.automation_command = Some(Box::new(|id, _| if id == "edit.toolbar" { Err("toolbar edits denied".into()) } else { Ok(()) }));
right_click(&mut app, &ctx, at, 1.0);
let row = flyout(&ctx).unwrap().center();
frame(&mut app, &ctx, 1.95, vec![Event::PointerMoved(row)]);
frame(&mut app, &ctx, 2.0, vec![button(row, egui::PointerButton::Primary, true)]);
frame(&mut app, &ctx, 2.05, vec![]);
frame(&mut app, &ctx, 2.1, vec![button(row, egui::PointerButton::Primary, false)]);
frame(&mut app, &ctx, 2.15, vec![]);
assert!(app.ui.dialogs.is_empty(), "the denied command opened nothing");
assert!(!open(&ctx));
assert_eq!(app.ui.status, "toolbar edits denied");
assert!(app.ui.status_error);
}