Managed mode: keep the admin settings and addons ratchets green

- The phone's OIDC card moves into MAdminOidcCard, so the settings section
  is back within its complexity limit after the managed-mode conditions.
- enabledPhotoProviderIds reads the enabled ids straight from the
  repository and has a test of its own, which brings the addons coverage
  back to its threshold.
This commit is contained in:
Maurice
2026-11-02 22:12:12 +00:00
committed by Maurice
parent f99b40cd81
commit 91bc1944dc
4 changed files with 78 additions and 51 deletions
+1 -1
View File
@@ -117,7 +117,7 @@ export class AddonsService {
/** The photo providers users can connect: none while the journey addon is off. */
async enabledPhotoProviderIds(): Promise<string[]> {
if (!(await this.isAddonEnabled(ADDON_IDS.JOURNEY))) return [];
return (await this.photoProviders.listEnabled()).flatMap((row) => (row.id ? [row.id] : []));
return this.photoProviders.listEnabledIds();
}
/** wanderer may be used: Tours is on and the admin allowed it under Tours. */
@@ -375,6 +375,15 @@ describe('AddonsService.list', () => {
expect(listSpy).not.toHaveBeenCalled();
listSpy.mockRestore();
});
it('names the photo providers users can connect: the enabled ones, none while the journey addon is off', async () => {
await insertProvider({ id: 'immich', name: 'Immich', icon: 'image', enabled: 1 });
await insertProvider({ id: 'off-provider', name: 'Off', icon: 'image', enabled: 0 });
expect(await svc.enabledPhotoProviderIds()).toEqual([]);
stubJourneyEnabled();
expect(await svc.enabledPhotoProviderIds()).toEqual(['immich']);
});
});
// Direct coverage of the enablement reads/writers relocated from