Do not reset share state (#7322)

* Do not reset received share state to pending if there is a state already

* Add changelog
This commit is contained in:
Andre Duffeck
2023-09-22 09:41:07 +02:00
committed by GitHub
parent 1a874ca89a
commit d5f73ba68d
2 changed files with 17 additions and 6 deletions
@@ -0,0 +1,5 @@
Bugfix: Do not reset state of received shares when rebuilding the jsoncs3 index
We fixed a problem with the "ocis migrate rebuild-jsoncs3-indexes" command which reset the state of received shares to "pending".
https://github.com/owncloud/ocis/issues/7319
+12 -6
View File
@@ -162,14 +162,20 @@ func RebuildJSONCS3Indexes(cfg *config.Config) *cli.Command {
switch share.Grantee.Type {
case provider.GranteeType_GRANTEE_TYPE_USER:
userid := share.Grantee.GetUserId().GetOpaqueId()
rs := &collaboration.ReceivedShare{
Share: share,
State: collaboration.ShareState_SHARE_STATE_PENDING,
}
err := mgr.UserReceivedStates.Add(ctx, userid, spaceId, rs)
existingState, err := mgr.UserReceivedStates.Get(ctx, userid, spaceId, share.Id.OpaqueId)
if err != nil {
fmt.Printf(" adding share '%s' to the user cache failed! (%s)\n", share.Id.OpaqueId, err.Error())
fmt.Printf(" retrieving current state of received share '%s' from the user cache failed! (%s)\n", share.Id.OpaqueId, err.Error())
errorsOccured = true
} else if existingState == nil {
rs := &collaboration.ReceivedShare{
Share: share,
State: collaboration.ShareState_SHARE_STATE_PENDING,
}
err := mgr.UserReceivedStates.Add(ctx, userid, spaceId, rs)
if err != nil {
fmt.Printf(" adding share '%s' to the user cache failed! (%s)\n", share.Id.OpaqueId, err.Error())
errorsOccured = true
}
}
case provider.GranteeType_GRANTEE_TYPE_GROUP:
groupid := share.Grantee.GetGroupId().GetOpaqueId()