mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Keep session and service gates distinct across paused actions
This commit is contained in:
1 parent
7a999cad6e
commit
3125470df6
2 files changed
+12
-9
No files matched your search
@@ -913,11 +913,8 @@ pub(crate) fn run_step_dialog(app: &mut PhotocraftApp, fields: &serde_json::Map<
|
||||
}
|
||||
let captured = paused.gate;
|
||||
let saved = app.session.authorize;
|
||||
let live = saved.or(if app.automation_input { app.services.automation_authorize } else { None });
|
||||
if let Some(authorize) = captured {
|
||||
authorize(command, ¶ms).map_err(|e| e.to_string())?;
|
||||
}
|
||||
if let Some(authorize) = live {
|
||||
let service = if app.automation_input { app.services.automation_authorize } else { None };
|
||||
for authorize in [captured, saved, service].into_iter().flatten() {
|
||||
authorize(command, ¶ms).map_err(|e| e.to_string())?;
|
||||
}
|
||||
if app.automation_input
|
||||
@@ -925,7 +922,7 @@ pub(crate) fn run_step_dialog(app: &mut PhotocraftApp, fields: &serde_json::Map<
|
||||
{
|
||||
authorize(command, ¶ms)?;
|
||||
}
|
||||
let gate = continuation_gate(captured, live)?;
|
||||
let gate = continuation_gate(captured, continuation_gate(saved, service)?)?;
|
||||
prepare_history(app, fields)?;
|
||||
app.session.authorize = gate;
|
||||
let result = app.run(command, params);
|
||||
@@ -1030,7 +1027,7 @@ pub fn resume(app: &mut PhotocraftApp, fields: &serde_json::Map<String, Value>)
|
||||
return Err(e.to_string());
|
||||
}
|
||||
let saved = app.session.authorize;
|
||||
let live = saved.or(if app.automation_input { app.services.automation_authorize } else { None });
|
||||
let service = if app.automation_input { app.services.automation_authorize } else { None };
|
||||
let remaining = !paused.then.is_empty()
|
||||
|| app
|
||||
.session
|
||||
@@ -1039,7 +1036,8 @@ pub fn resume(app: &mut PhotocraftApp, fields: &serde_json::Map<String, Value>)
|
||||
.iter()
|
||||
.find(|action| action.name == paused.action)
|
||||
.is_some_and(|action| action.enabled_steps().any(|(i, _)| i >= paused.from));
|
||||
let gate = if remaining { continuation_gate(paused.gate, live) } else { Ok(live.or(paused.gate)) };
|
||||
let gate =
|
||||
if remaining { continuation_gate(saved, service).and_then(|live| continuation_gate(paused.gate, live)) } else { Ok(saved.or(service).or(paused.gate)) };
|
||||
let gate = match gate {
|
||||
Ok(gate) => gate,
|
||||
Err(error) => {
|
||||
|
||||
@@ -2351,7 +2351,9 @@ fn paused_spelling_checks_the_live_gate_before_resuming_history() {
|
||||
let before = app.session.active().unwrap().doc.clone();
|
||||
let rows = app.session.active().unwrap().history.entries();
|
||||
let token = app.ui.type_panels.spell.as_ref().unwrap().resume.unwrap();
|
||||
app.session.authorize = None;
|
||||
if service != 1 {
|
||||
app.session.authorize = None;
|
||||
}
|
||||
match service {
|
||||
0 => app.session.authorize = Some(deny_correction),
|
||||
1 => {
|
||||
@@ -2465,6 +2467,9 @@ fn paused_adjustments_bind_implicit_pixel_and_mask_receivers() {
|
||||
app.run("layer.layerMask.revealAll", json!({})).unwrap();
|
||||
app.run("edit.fill", json!({"color":"#808080","target":"mask"})).unwrap();
|
||||
let b = photocraft_doc::LayerId(app.run("layer.new.layer", json!({"name":"B"})).unwrap()["layer"].as_u64().unwrap());
|
||||
// Native mask eligibility checks the active layer, so keep both receivers eligible.
|
||||
// The assertions below still require the explicitly named A mask alone to change.
|
||||
app.run("layer.layerMask.revealAll", json!({})).unwrap();
|
||||
app.session.select_layer(a).unwrap();
|
||||
let mut params = json!({"brightness":40});
|
||||
if mask {
|
||||
|
||||
Reference in new issue
Block a user