mirror of
https://github.com/outline/outline.git
synced 2026-11-22 14:01:41 +03:00
* feat: Sync group descriptions and re-sync groups on SSO validation - Sync group descriptions from group sync providers alongside names - Lock name and description edits for externally synced groups at the API layer and in the edit dialog - Move group sync into a SyncUserGroupsTask, scheduled from login and from ValidateSSOAccessTask after a fresh provider validation - Add authenticationProviders.startGroupSync for providers that require an admin consent flow before group sync can be enabled Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix: Make group sync setup generic and deduplicate sync jobs - Expose groupSyncRequiresSetup from the provider list and use it in the settings scene instead of checking for the azure provider name - Rename the setup redirect query param to groupSync - Give SyncUserGroupsTask a job id per user authentication so concurrent syncs for the same authentication are not queued twice * Use existing hook --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
54 lines
1.1 KiB
TypeScript
54 lines
1.1 KiB
TypeScript
import { vi } from "vitest";
|
|
|
|
export class MutexLock {
|
|
// Default expiry time for acquiring lock in milliseconds
|
|
public static defaultLockTimeout = 4000;
|
|
|
|
/**
|
|
* Acquires a mock lock.
|
|
*/
|
|
public static acquire = vi.fn().mockResolvedValue({
|
|
release: vi.fn().mockResolvedValue(true),
|
|
expiration: Date.now() + 10000,
|
|
});
|
|
|
|
/**
|
|
* Runs the routine without a lock.
|
|
*/
|
|
public static using = vi.fn(
|
|
(
|
|
_resource: string,
|
|
_timeout: number,
|
|
routine: (signal: { aborted: boolean }) => unknown
|
|
) => routine({ aborted: false })
|
|
);
|
|
|
|
/**
|
|
* Runs the routine without a lock.
|
|
*/
|
|
public static tryUsing = vi.fn(
|
|
(
|
|
_resource: string,
|
|
_timeout: number,
|
|
routine: (signal: { aborted: boolean }) => unknown
|
|
) => routine({ aborted: false })
|
|
);
|
|
|
|
/**
|
|
* Releases a mock lock.
|
|
*/
|
|
public static release = vi.fn().mockResolvedValue(true);
|
|
|
|
/**
|
|
* Returns the mock redlock instance
|
|
*/
|
|
public static get lock() {
|
|
return {
|
|
acquire: vi.fn().mockResolvedValue({
|
|
release: vi.fn().mockResolvedValue(true),
|
|
expiration: Date.now() + 10000,
|
|
}),
|
|
};
|
|
}
|
|
}
|