mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-25 07:22:39 +03:00
fix: client not saving avatar blob on first creating workspace (#974)
This commit is contained in:
parent
b69eb3437b
commit
79506f1ce2
@ -10,10 +10,11 @@ import {
|
||||
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
|
||||
import { IPCBlobProvider } from './blocksuite-provider/blob.js';
|
||||
import type { WorkspaceUnit } from 'src/workspace-unit.js';
|
||||
import { createWorkspaceUnit, loadWorkspaceUnit } from '../local/utils.js';
|
||||
import { loadWorkspaceUnit } from '../local/utils.js';
|
||||
import { WorkspaceWithPermission } from './ipc/types/workspace.js';
|
||||
import { applyUpdate } from '../../utils/index.js';
|
||||
import { User } from 'src/types/index.js';
|
||||
import { createWorkspaceUnit } from './utils.js';
|
||||
|
||||
/**
|
||||
* init - createUser - create first workspace and ydoc - loadWorkspace - return the first workspace - wrapWorkspace - #initDocFromIPC - applyUpdate - on('update') - updateYDocument
|
||||
|
25
packages/data-center/src/provider/tauri-ipc/utils.ts
Normal file
25
packages/data-center/src/provider/tauri-ipc/utils.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { WorkspaceUnit } from '../../workspace-unit.js';
|
||||
import type { WorkspaceUnitCtorParams } from '../../workspace-unit';
|
||||
import { createBlocksuiteWorkspace } from '../../utils/index.js';
|
||||
import { setDefaultAvatar } from '../utils.js';
|
||||
import { IPCBlobProvider } from './blocksuite-provider/blob.js';
|
||||
|
||||
export const createWorkspaceUnit = async (params: WorkspaceUnitCtorParams) => {
|
||||
const workspaceUnit = new WorkspaceUnit(params);
|
||||
|
||||
const blocksuiteWorkspace = createBlocksuiteWorkspace(workspaceUnit.id, {
|
||||
blobOptionsGetter: (k: string) => undefined,
|
||||
});
|
||||
blocksuiteWorkspace.meta.setName(workspaceUnit.name);
|
||||
(await blocksuiteWorkspace.blobs)?.setProvider(
|
||||
await IPCBlobProvider.init(workspaceUnit.id)
|
||||
);
|
||||
if (!workspaceUnit.avatar) {
|
||||
await setDefaultAvatar(blocksuiteWorkspace);
|
||||
workspaceUnit.update({ avatar: blocksuiteWorkspace.meta.avatar });
|
||||
}
|
||||
|
||||
workspaceUnit.setBlocksuiteWorkspace(blocksuiteWorkspace);
|
||||
|
||||
return workspaceUnit;
|
||||
};
|
Loading…
Reference in New Issue
Block a user