mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
fix(server): force full sync on either public users transition
Re-enabling public users left previously hidden users stuck missing from non-admin candidate lists, for the same reason as the disable direction: incremental sync never re-fetches already-acked rows.
This commit is contained in:
parent
36f1744063
commit
3cc2d61b32
2 changed files with 13 additions and 3 deletions
|
|
@ -89,7 +89,7 @@ const throwSessionRequired = () => {
|
|||
export class SyncService extends BaseService {
|
||||
@OnEvent({ name: 'ConfigUpdate', workers: [ImmichWorker.Api] })
|
||||
async onConfigUpdate({ newConfig, oldConfig }: ArgOf<'ConfigUpdate'>) {
|
||||
if (oldConfig.server.publicUsers && !newConfig.server.publicUsers) {
|
||||
if (oldConfig.server.publicUsers !== newConfig.server.publicUsers) {
|
||||
await this.sessionRepository.requireFullSyncForNonAdmins();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,14 +275,14 @@ describe(SyncService.name, () => {
|
|||
await expect(isPendingSyncReset(ctx.database, session.id)).resolves.toBe(false);
|
||||
});
|
||||
|
||||
it('should not require a full sync when public users is enabled', async () => {
|
||||
it('should require a full sync for non-admins when public users is enabled', async () => {
|
||||
const { sut, ctx } = setup(await getKyselyDB());
|
||||
const { user } = await ctx.newUser();
|
||||
const { session } = await ctx.newSession({ userId: user.id });
|
||||
|
||||
await sut.onConfigUpdate({ oldConfig: withPublicUsers(false), newConfig: withPublicUsers(true) });
|
||||
|
||||
await expect(isPendingSyncReset(ctx.database, session.id)).resolves.toBe(false);
|
||||
await expect(isPendingSyncReset(ctx.database, session.id)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it('should not require a full sync when public users was already disabled', async () => {
|
||||
|
|
@ -294,5 +294,15 @@ describe(SyncService.name, () => {
|
|||
|
||||
await expect(isPendingSyncReset(ctx.database, session.id)).resolves.toBe(false);
|
||||
});
|
||||
|
||||
it('should not require a full sync when public users was already enabled', async () => {
|
||||
const { sut, ctx } = setup(await getKyselyDB());
|
||||
const { user } = await ctx.newUser();
|
||||
const { session } = await ctx.newSession({ userId: user.id });
|
||||
|
||||
await sut.onConfigUpdate({ oldConfig: withPublicUsers(true), newConfig: withPublicUsers(true) });
|
||||
|
||||
await expect(isPendingSyncReset(ctx.database, session.id)).resolves.toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue