1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 17:44:59 +09:00

GO-2966 Remove invite details from space view

This commit is contained in:
mcrakhman 2024-02-27 10:12:31 +01:00
parent 32ed1830c2
commit 8913e06136
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B

View file

@ -212,7 +212,11 @@ func (a *aclService) StopSharing(ctx context.Context, spaceId string) error {
if err != nil {
return fmt.Errorf("%w, %w", ErrAclRequestFailed, err)
}
return nil
spaceViewId, err := a.spaceService.SpaceViewId(spaceId)
if err != nil {
return fmt.Errorf("get space view id: %w", err)
}
return a.removeExistingInviteFileInfo(spaceViewId)
}
func (a *aclService) Join(ctx context.Context, spaceId string, inviteCid cid.Cid, inviteFileKey crypto.SymKey) error {
@ -406,6 +410,14 @@ func (a *aclService) getExistingInviteFileInfo(spaceViewId string) (fileCid stri
return
}
func (a *aclService) removeExistingInviteFileInfo(spaceViewId string) (err error) {
return getblock.Do(a.objectGetter, spaceViewId, func(sb smartblock.SmartBlock) error {
newState := sb.NewState()
newState.RemoveDetail(bundle.RelationKeySpaceInviteFileCid.String(), bundle.RelationKeySpaceInviteFileKey.String())
return sb.Apply(newState)
})
}
func (a *aclService) GetCurrentInvite(spaceId string) (*InviteInfo, error) {
spaceViewId, err := a.spaceService.SpaceViewId(spaceId)
if err != nil {