diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index c70b783..96ad8e0 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -124,7 +124,9 @@ export class HomePage implements OnDestroy { return comunitaIds.includes(c.id_canti) || comunitaIds.includes(c.id); }); - // Deduplicate: if a song exists in both validated and unvalidated lists, keep only the unvalidated/custom one + // Deduplicate: if a song exists in both validated and unvalidated lists, + // the NON-VALIDATED (parish-customized) version always takes precedence, + // so parishes can always personalize their songs even if never validated. const seen = new Map(); for (const canto of list) { const key = canto.id_canti || canto.id; @@ -132,8 +134,9 @@ export class HomePage implements OnDestroy { if (!existing) { seen.set(key, canto); } else { - // Precedence to unvalidated/custom version - if (canto.nonValidato) { + // Precedence to non-validated (parish custom) version: + // overwrite only if current entry is validated and new one is non-validated + if (!existing.nonValidato && canto.nonValidato) { seen.set(key, canto); } } diff --git a/src/app/services/comunita.service.ts b/src/app/services/comunita.service.ts index 554d724..32952ee 100644 --- a/src/app/services/comunita.service.ts +++ b/src/app/services/comunita.service.ts @@ -60,7 +60,12 @@ export class ComunitaService { if (savedCode) { this.comunitaCode.set(savedCode); // Run background refresh 1 second after startup to fetch any new custom canti or updates + // but only if the community feature is enabled in settings setTimeout(() => { + if (!this.settingsService.comunitaEnabled()) { + // Community is disabled: skip refresh to avoid re-enabling the filter + return; + } this.setComunitaCode(savedCode).catch(err => { console.warn('Failed background community refresh at startup:', err); });