fix automation visibility and execution by profile ownership

This commit is contained in:
Mateusz Gruszczyński
2026-06-07 22:52:17 +02:00
parent 79e0ce8051
commit 51e00a4e37
5 changed files with 232 additions and 118 deletions
+3 -2
View File
@@ -58,8 +58,9 @@ def _run_slow_profile_tasks(socketio, profile: dict, profile_id: int) -> None:
except Exception as exc:
_emit_profile(socketio, "smart_queue_update", {"ok": False, "profile_id": profile_id, "error": str(exc)}, profile_id)
try:
auto_result = automation_rules.check(profile, user_id=profile_user_id, force=False)
if auto_result.get("applied"):
# Note: Automations are profile-scoped; each queued job still runs as the rule owner.
auto_result = automation_rules.check(profile, force=False)
if auto_result.get("applied") or auto_result.get("batches"):
_emit_profile(socketio, "automation_update", auto_result, profile_id)
except Exception as exc:
_emit_profile(socketio, "automation_update", {"ok": False, "profile_id": profile_id, "error": str(exc)}, profile_id)