refactor: decouple sync master switch from database check results

Previously, Fix Database would force-enable or force-disable syncEnabled based on check results. Now the master sync switch is fully user-controlled and independent of database health.

Database issues are now shown as a non-blocking warning appended to the status text instead of replacing it. This allows users to:
- Keep sync enabled even with database issues (at their own risk)
- Disable sync independently of database health
- See both sync status and database warnings simultaneously

Changes:
- Remove syncEnabled updates from database check/fix operations
- Append database warning to status text instead of replacing it
- Update user-facing notices to remove sync enable/disable messaging

🤖 Sisyphus via OhMyOpenCode
<!-- OMO_INTERNAL_INITIATOR -->
This commit is contained in:
HeroBlackInk 2026-02-22 15:01:10 +08:00
parent 93f6e2f6b8
commit 75fe2080fb

View file

@ -209,15 +209,16 @@ export class UltimateTodoistSyncSettingTab extends PluginSettingTab {
const t2oEnabled = this.plugin.settings.todoistToObsidianEnabled;
let statusText = '';
if (!passed) {
statusText = '⚠️ Blocked - database issues detected';
} else if (!mainEnabled) {
if (!mainEnabled) {
statusText = '❌ Disabled';
} else {
const o2t = o2tEnabled ? '✅' : '❌';
const t2o = t2oEnabled ? '✅' : '❌';
statusText = `✅ Enabled (O→T: ${o2t}, T→O: ${t2o})`;
}
if (!passed) {
statusText += ' ⚠️ (database issues detected — some tasks may be skipped)';
}
syncStatusEl.innerHTML = `<div><strong>Status:</strong> ${statusText}</div>`;
};
@ -319,12 +320,11 @@ export class UltimateTodoistSyncSettingTab extends PluginSettingTab {
progressNotice.hide();
await this.plugin.safeSettings?.update({
lastDatabaseCheckTime: Date.now(),
lastDatabaseCheckPassed: true,
syncEnabled: true
lastDatabaseCheckPassed: true
}, true);
updateSyncStatus();
updateCheckStatus();
new Notice('✅ Database is healthy. Sync enabled.');
new Notice('✅ Database is healthy.');
return;
}
// Step 2: Rebuild cache to fix what can be fixed
@ -342,16 +342,15 @@ export class UltimateTodoistSyncSettingTab extends PluginSettingTab {
const remainingCount = after.totalIssues;
await this.plugin.safeSettings?.update({
lastDatabaseCheckTime: Date.now(),
lastDatabaseCheckPassed: after.success,
syncEnabled: after.success
lastDatabaseCheckPassed: after.success
}, true);
updateSyncStatus();
updateCheckStatus();
if (after.success) {
new Notice(`✅ Fixed ${fixedCount} issues. Database is healthy. Sync enabled.`);
new Notice(`✅ Fixed ${fixedCount} issues. Database is healthy.`);
} else {
new Notice(
`⚠️ Fixed ${fixedCount} issues. ${remainingCount} remain (content conflicts, missing files — manual fix needed). Sync disabled.`,
`⚠️ Fixed ${fixedCount} issues. ${remainingCount} remain (content conflicts, missing files — manual fix needed).`,
8000
);
}