mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 10:39:32 +01:00
fix: apply the review items for #727 at merge
toggleSessionImageWatcher checks the response, so any refusal puts the switch back and toasts an error instead of a success; architecture- invariants says the image watcher never watches a remote workingDir. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2c2f69adba
commit
dd56674a1d
2 files changed
+11
-3
No files matched your search
@@ -3152,9 +3152,17 @@ Object.assign(CodemanApp.prototype, {
|
||||
|
||||
async toggleSessionImageWatcher() {
|
||||
if (!this.editingSessionId) return;
|
||||
const enabled = document.getElementById('modalImageWatcherEnabled').checked;
|
||||
const toggle = document.getElementById('modalImageWatcherEnabled');
|
||||
const enabled = toggle.checked;
|
||||
try {
|
||||
await this._apiPost(`/api/sessions/${this.editingSessionId}/image-watcher`, { enabled });
|
||||
const res = await this._apiPost(`/api/sessions/${this.editingSessionId}/image-watcher`, { enabled });
|
||||
// `_apiPost` hands back the Response without checking it, so a refused request (a 400) must not
|
||||
// read as a save: put the switch back and say so.
|
||||
if (!res?.ok) {
|
||||
toggle.checked = !enabled;
|
||||
this.showToast('Failed to toggle image watcher', 'error');
|
||||
return;
|
||||
}
|
||||
// Update local session state
|
||||
const session = this.sessions.get(this.editingSessionId);
|
||||
if (session) {
|
||||
|
||||
Reference in new issue
Block a user