mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 20:46:38 +08:00
fix: test case
This commit is contained in:
@@ -46,10 +46,10 @@ export class PgUserspaceDocStorageAdapter extends DocStorageAdapter {
|
||||
}
|
||||
|
||||
async pushDocUpdates(
|
||||
editorId: string,
|
||||
userId: string,
|
||||
docId: string,
|
||||
updates: Uint8Array[]
|
||||
updates: Uint8Array[],
|
||||
editorId?: string
|
||||
) {
|
||||
if (!updates.length) {
|
||||
return 0;
|
||||
|
||||
@@ -36,10 +36,10 @@ export class PgWorkspaceDocStorageAdapter extends DocStorageAdapter {
|
||||
}
|
||||
|
||||
async pushDocUpdates(
|
||||
editorId: string,
|
||||
workspaceId: string,
|
||||
docId: string,
|
||||
updates: Uint8Array[]
|
||||
updates: Uint8Array[],
|
||||
editorId?: string
|
||||
) {
|
||||
if (!updates.length) {
|
||||
return 0;
|
||||
@@ -270,7 +270,7 @@ export class PgWorkspaceDocStorageAdapter extends DocStorageAdapter {
|
||||
}
|
||||
|
||||
override async rollbackDoc(
|
||||
editorId: string,
|
||||
editorId: string | undefined,
|
||||
spaceId: string,
|
||||
docId: string,
|
||||
timestamp: number
|
||||
|
||||
@@ -97,10 +97,10 @@ export abstract class DocStorageAdapter extends Connection {
|
||||
}
|
||||
|
||||
abstract pushDocUpdates(
|
||||
editorId: string,
|
||||
spaceId: string,
|
||||
docId: string,
|
||||
updates: Uint8Array[]
|
||||
updates: Uint8Array[],
|
||||
editorId?: string
|
||||
): Promise<number>;
|
||||
|
||||
abstract deleteDoc(spaceId: string, docId: string): Promise<void>;
|
||||
@@ -124,7 +124,7 @@ export abstract class DocStorageAdapter extends Connection {
|
||||
}
|
||||
|
||||
const change = this.generateChangeUpdate(fromSnapshot.bin, toSnapshot.bin);
|
||||
await this.pushDocUpdates(editorId, spaceId, docId, [change]);
|
||||
await this.pushDocUpdates(spaceId, docId, [change], editorId);
|
||||
// force create a new history record after rollback
|
||||
await this.createDocHistory(fromSnapshot, true);
|
||||
}
|
||||
|
||||
@@ -277,10 +277,10 @@ export class SpaceSyncGateway
|
||||
|
||||
// TODO(@forehalo): we might need to check write permission before push updates
|
||||
const timestamp = await adapter.push(
|
||||
user.id,
|
||||
spaceId,
|
||||
docId,
|
||||
updates.map(update => Buffer.from(update, 'base64'))
|
||||
updates.map(update => Buffer.from(update, 'base64')),
|
||||
user.id
|
||||
);
|
||||
|
||||
// could be put in [adapter.push]
|
||||
@@ -601,9 +601,9 @@ abstract class SyncSocketAdapter {
|
||||
permission?: Permission
|
||||
): Promise<void>;
|
||||
|
||||
push(editorId: string, spaceId: string, docId: string, updates: Buffer[]) {
|
||||
push(spaceId: string, docId: string, updates: Buffer[], editorId: string) {
|
||||
this.assertIn(spaceId);
|
||||
return this.storage.pushDocUpdates(editorId, spaceId, docId, updates);
|
||||
return this.storage.pushDocUpdates(spaceId, docId, updates, editorId);
|
||||
}
|
||||
|
||||
get(spaceId: string, docId: string) {
|
||||
@@ -627,13 +627,13 @@ class WorkspaceSyncAdapter extends SyncSocketAdapter {
|
||||
}
|
||||
|
||||
override push(
|
||||
editorId: string,
|
||||
spaceId: string,
|
||||
docId: string,
|
||||
updates: Buffer[]
|
||||
updates: Buffer[],
|
||||
editorId: string
|
||||
) {
|
||||
const id = new DocID(docId, spaceId);
|
||||
return super.push(editorId, spaceId, id.guid, updates);
|
||||
return super.push(spaceId, id.guid, updates, editorId);
|
||||
}
|
||||
|
||||
override get(spaceId: string, docId: string) {
|
||||
|
||||
Reference in New Issue
Block a user