mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-09 09:35:00 +09:00
GO-2548 Fix space creation
This commit is contained in:
parent
4751d8437a
commit
6689668d89
3 changed files with 16 additions and 13 deletions
|
@ -34,7 +34,7 @@ func (s *service) createPersonalSpace(ctx context.Context) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func (s *service) create(ctx context.Context) (clientspace.Space, error) {
|
||||
func (s *service) create(ctx context.Context) (sp clientspace.Space, err error) {
|
||||
coreSpace, err := s.spaceCore.Create(ctx, s.repKey, s.metadataPayload)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -46,6 +46,17 @@ func (s *service) create(ctx context.Context) (clientspace.Space, error) {
|
|||
}
|
||||
s.mu.Unlock()
|
||||
ctrl, err := s.factory.CreateShareableSpace(ctx, coreSpace.Id())
|
||||
if err != nil {
|
||||
s.mu.Lock()
|
||||
close(wait)
|
||||
s.waiting[coreSpace.Id()] = controllerWaiter{
|
||||
wait: wait,
|
||||
err: err,
|
||||
}
|
||||
s.mu.Unlock()
|
||||
return nil, err
|
||||
}
|
||||
sp, err = ctrl.Current().(loader.LoadWaiter).WaitLoad(ctx)
|
||||
s.mu.Lock()
|
||||
close(wait)
|
||||
if err != nil {
|
||||
|
@ -58,5 +69,5 @@ func (s *service) create(ctx context.Context) (clientspace.Space, error) {
|
|||
}
|
||||
s.spaceControllers[ctrl.SpaceId()] = ctrl
|
||||
s.mu.Unlock()
|
||||
return ctrl.Current().(loader.LoadWaiter).WaitLoad(ctx)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -80,14 +80,10 @@ func (s *service) loadPersonalSpace(ctx context.Context) (err error) {
|
|||
_, err = ctrl.Current().(loader.LoadWaiter).WaitLoad(ctx)
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
close(wait)
|
||||
if err != nil {
|
||||
s.waiting[s.personalSpaceId] = controllerWaiter{
|
||||
wait: wait,
|
||||
err: err,
|
||||
}
|
||||
return
|
||||
return err
|
||||
}
|
||||
close(wait)
|
||||
s.spaceControllers[s.personalSpaceId] = ctrl
|
||||
return
|
||||
}
|
||||
|
|
|
@ -126,14 +126,10 @@ func (s *spaceFactory) NewShareableSpace(ctx context.Context, id string, status
|
|||
}
|
||||
|
||||
func (s *spaceFactory) CreateShareableSpace(ctx context.Context, id string) (sp spacecontroller.SpaceController, err error) {
|
||||
//coreSpace, err := s.spaceCore.Create(ctx, s.repKey, s.metadataPayload)
|
||||
//if err != nil {
|
||||
// return
|
||||
//}
|
||||
if err := s.techSpace.SpaceViewCreate(ctx, id, true); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctrl, err := shareablespace.NewSpaceController(id, false, spaceinfo.AccountStatusUnknown, s.app)
|
||||
ctrl, err := shareablespace.NewSpaceController(id, true, spaceinfo.AccountStatusUnknown, s.app)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue