fix: restore build and stabilize E2E cross-signal behavior
Revert the automated member-ordering pass that broke Angular field init (TS2729) and disable that rule until a safe reorder strategy exists. Fix modal/confirm dialog i18n defaults via template fallbacks, search all active endpoints (including offline), register foreign rooms with actor owner IDs, sync profile display names from avatar summaries, and guard dm-chat when a private call converts to a group conversation. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -59,7 +59,7 @@ function scheduleStorageRemove(key: string): void {
|
||||
scheduleStorageFlush();
|
||||
}
|
||||
|
||||
function readPendingOrStored(key: string): string | null {
|
||||
function readMaybePending(key: string): string | null {
|
||||
if (pendingWrites.has(key)) {
|
||||
return pendingWrites.get(key) ?? null;
|
||||
}
|
||||
@@ -73,8 +73,8 @@ function readPendingOrStored(key: string): string | null {
|
||||
|
||||
export function loadGeneralSettingsFromStorage(): GeneralSettings {
|
||||
try {
|
||||
const raw = readPendingOrStored(getUserScopedStorageKey(STORAGE_KEY_GENERAL_SETTINGS))
|
||||
?? readPendingOrStored(STORAGE_KEY_GENERAL_SETTINGS);
|
||||
const raw = readMaybePending(getUserScopedStorageKey(STORAGE_KEY_GENERAL_SETTINGS))
|
||||
?? readMaybePending(STORAGE_KEY_GENERAL_SETTINGS);
|
||||
|
||||
if (!raw) {
|
||||
return { ...DEFAULT_GENERAL_SETTINGS };
|
||||
@@ -99,8 +99,8 @@ export function saveGeneralSettingsToStorage(patch: Partial<GeneralSettings>): G
|
||||
|
||||
export function loadLastViewedChatFromStorage(userId?: string | null): LastViewedChatSnapshot | null {
|
||||
try {
|
||||
const raw = readPendingOrStored(getUserScopedStorageKey(STORAGE_KEY_LAST_VIEWED_CHAT, userId))
|
||||
?? readPendingOrStored(STORAGE_KEY_LAST_VIEWED_CHAT);
|
||||
const raw = readMaybePending(getUserScopedStorageKey(STORAGE_KEY_LAST_VIEWED_CHAT, userId))
|
||||
?? readMaybePending(STORAGE_KEY_LAST_VIEWED_CHAT);
|
||||
|
||||
if (!raw) {
|
||||
return null;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/member-ordering, */
|
||||
import {
|
||||
inject,
|
||||
Injectable,
|
||||
@@ -37,22 +38,16 @@ export interface RoomMessageStats {
|
||||
*/
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class DatabaseService {
|
||||
private readonly platform = inject(PlatformService);
|
||||
private readonly browserDb = inject(BrowserDatabaseService);
|
||||
private readonly capacitorDb = inject(CapacitorDatabaseService);
|
||||
private readonly electronDb = inject(ElectronDatabaseService);
|
||||
private initializationPromise: Promise<void> | null = null;
|
||||
private validatedUserScope: string | null | undefined;
|
||||
|
||||
/** Reactive flag: `true` once {@link initialize} has completed. */
|
||||
isReady = signal(false);
|
||||
|
||||
private readonly platform = inject(PlatformService);
|
||||
|
||||
private readonly browserDb = inject(BrowserDatabaseService);
|
||||
|
||||
private readonly capacitorDb = inject(CapacitorDatabaseService);
|
||||
|
||||
private readonly electronDb = inject(ElectronDatabaseService);
|
||||
|
||||
private initializationPromise: Promise<void> | null = null;
|
||||
|
||||
private validatedUserScope: string | null | undefined;
|
||||
|
||||
/** The active storage backend for the current platform. */
|
||||
private get backend() {
|
||||
const backendKind = resolveDatabaseBackend({
|
||||
@@ -99,6 +94,22 @@ export class DatabaseService {
|
||||
await this.initializationPromise;
|
||||
}
|
||||
|
||||
private async ensureReady(): Promise<void> {
|
||||
const userScope = getStoredCurrentUserId();
|
||||
|
||||
if (this.isReady() && this.validatedUserScope === userScope) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.initialize();
|
||||
}
|
||||
|
||||
private async withReady<T>(operation: () => Promise<T>): Promise<T> {
|
||||
await this.ensureReady();
|
||||
|
||||
return operation();
|
||||
}
|
||||
|
||||
/** Persist a single chat message. */
|
||||
saveMessage(message: Message) { return this.withReady(() => this.backend.saveMessage(message)); }
|
||||
|
||||
@@ -221,21 +232,4 @@ export class DatabaseService {
|
||||
|
||||
/** Wipe all persisted data. */
|
||||
clearAllData() { return this.withReady(() => this.backend.clearAllData()); }
|
||||
|
||||
private async ensureReady(): Promise<void> {
|
||||
const userScope = getStoredCurrentUserId();
|
||||
|
||||
if (this.isReady() && this.validatedUserScope === userScope) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.initialize();
|
||||
}
|
||||
|
||||
private async withReady<T>(operation: () => Promise<T>): Promise<T> {
|
||||
await this.ensureReady();
|
||||
|
||||
return operation();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user