mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-22 17:31:56 -04:00
Merge pull request #7336 from aduffeck/backport-jsoncs3-rebuild-fix
Do not reset received share state to pending if there is a state already
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
Bugfix: Do not reset received share state to pending
|
||||
|
||||
We fixed a problem where the states of received shares were reset to PENDING
|
||||
in the "ocis migrate rebuild-jsoncs3-indexes" command
|
||||
|
||||
https://github.com/owncloud/ocis/issues/7319
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user