mirror of
https://github.com/dataelement/bisheng.git
synced 2026-08-28 17:14:44 +08:00
87bfe5cff6
For APPROVAL knowledge spaces, subscribe_space() wrote the PENDING space_channel_member row *before* invoking the approval gate. When the scenario was missing/disabled the gate raised ApprovalScenarioDisabledError, so the user saw an error but the PENDING membership was already committed. On the next click the top-of-function 'already pending -> return pending' early-return short-circuited before the gate, masking the error (first click errors, second click silently succeeds). Invoke the gate first and persist membership only after it decides (pass -> ACTIVE, pending/exception -> PENDING) via a new _persist_space_member() helper. A missing scenario now leaves no membership and errors consistently on every click. Also repair pre-existing bitrot in the approval integration tests (quota is_admin, str-enum decision/task_ids, unmocked department DAO).