mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-29 00:06:09 +08:00
feat(core): add blocksuite writer info service (#10754)
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
type PageEditor,
|
||||
} from '@affine/core/blocksuite/editors';
|
||||
import { useEnableAI } from '@affine/core/components/hooks/affine/use-enable-ai';
|
||||
import { AuthService, PublicUserService } from '@affine/core/modules/cloud';
|
||||
import { PublicUserService } from '@affine/core/modules/cloud';
|
||||
import type { DocCustomPropertyInfo } from '@affine/core/modules/db';
|
||||
import { DocService, DocsService } from '@affine/core/modules/doc';
|
||||
import type {
|
||||
@@ -94,7 +94,6 @@ const usePatchSpecs = (mode: DocMode) => {
|
||||
featureFlagService,
|
||||
memberSearchService,
|
||||
publicUserService,
|
||||
authService,
|
||||
} = useServices({
|
||||
PeekViewService,
|
||||
DocService,
|
||||
@@ -104,7 +103,6 @@ const usePatchSpecs = (mode: DocMode) => {
|
||||
FeatureFlagService,
|
||||
MemberSearchService,
|
||||
PublicUserService,
|
||||
AuthService,
|
||||
});
|
||||
const isCloud = workspaceService.workspace.flavour !== 'local';
|
||||
const framework = useFramework();
|
||||
@@ -167,7 +165,7 @@ const usePatchSpecs = (mode: DocMode) => {
|
||||
isCloud
|
||||
? [
|
||||
patchUserListExtensions(memberSearchService),
|
||||
patchUserExtensions(publicUserService, authService),
|
||||
patchUserExtensions(publicUserService),
|
||||
]
|
||||
: [],
|
||||
mode === 'edgeless' && enableTurboRenderer
|
||||
@@ -201,7 +199,6 @@ const usePatchSpecs = (mode: DocMode) => {
|
||||
isCloud,
|
||||
memberSearchService,
|
||||
publicUserService,
|
||||
authService,
|
||||
enableTurboRenderer,
|
||||
featureFlagService.flags.enable_pdf_embed_preview.value,
|
||||
]);
|
||||
|
||||
@@ -1,24 +1,8 @@
|
||||
import type {
|
||||
AuthService,
|
||||
PublicUserService,
|
||||
} from '@affine/core/modules/cloud';
|
||||
import type { PublicUserService } from '@affine/core/modules/cloud';
|
||||
import { UserServiceExtension } from '@blocksuite/affine/shared/services';
|
||||
|
||||
export function patchUserExtensions(
|
||||
publicUserService: PublicUserService,
|
||||
authService: AuthService
|
||||
) {
|
||||
export function patchUserExtensions(publicUserService: PublicUserService) {
|
||||
return UserServiceExtension({
|
||||
getCurrentUser() {
|
||||
const account = authService.session.account$.value;
|
||||
return account
|
||||
? {
|
||||
id: account.id,
|
||||
avatar: account.avatar,
|
||||
name: account.label,
|
||||
}
|
||||
: null;
|
||||
},
|
||||
// eslint-disable-next-line rxjs/finnish
|
||||
userInfo$(id) {
|
||||
return publicUserService.publicUser$(id).signal;
|
||||
|
||||
Reference in New Issue
Block a user