mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-24 04:03:11 +02:00
installModule() ended with an unconditional setState(Enabled). Store updates, zip uploads and plain reinstalls all pass through it, so switching a module off in the panel survived only until its next update — which is how a disabled plex came back and then blocked `watch` from being disabled at all. The admin's choice is now captured before the Installing transition overwrites it and restored at the end; a first install still enables, since there is no choice to preserve. stateAfterInstall() reads the raw override rather than listModules() so the transient Installing / Failed states cannot be mistaken for a deliberate "disabled". Restoring that state uses the new writeState() instead of setState(): putting a module back into the state it already had is a lifecycle transition, not an admin "disable", and must not be vetoed by the dependents guard — otherwise updating a disabled `watch` would fail at the last step because `plex` exists. setState() keeps the guard for the deliberate case. Three tests cover it; two of them fail against the previous behaviour. Verified: 860 tests, make gates, CRAP gate.