diff --git a/commonspace/space.go b/commonspace/space.go index 26849049..235b4a2e 100644 --- a/commonspace/space.go +++ b/commonspace/space.go @@ -423,6 +423,10 @@ func (s *space) onObjectClose(id string) { } func (s *space) onSpaceDelete() { + err := s.storage.SetSpaceDeleted() + if err != nil { + log.Debug("failed to set space deleted") + } s.isDeleted.Swap(true) } diff --git a/commonspace/spaceservice.go b/commonspace/spaceservice.go index d8f292aa..08c30308 100644 --- a/commonspace/spaceservice.go +++ b/commonspace/spaceservice.go @@ -121,6 +121,11 @@ func (s *spaceService) NewSpace(ctx context.Context, id string) (Space, error) { spaceIsClosed = &atomic.Bool{} spaceIsDeleted = &atomic.Bool{} ) + isDeleted, err := st.IsSpaceDeleted() + if err != nil { + return nil, err + } + spaceIsDeleted.Swap(isDeleted) getter := newCommonGetter(st.Id(), s.treeGetter, spaceIsClosed) syncStatus := syncstatus.NewNoOpSyncStatus() // this will work only for clients, not the best solution, but... diff --git a/commonspace/spacestorage/spacestorage.go b/commonspace/spacestorage/spacestorage.go index 0883af9a..1562d6b1 100644 --- a/commonspace/spacestorage/spacestorage.go +++ b/commonspace/spacestorage/spacestorage.go @@ -29,6 +29,8 @@ const ( // TODO: consider moving to some file with all common interfaces etc type SpaceStorage interface { Id() string + SetSpaceDeleted() error + IsSpaceDeleted() (bool, error) SetTreeDeletedStatus(id, state string) error TreeDeletedStatus(id string) (string, error) SpaceSettingsId() string