diff --git a/changelog/unreleased/fix-listing-shares-to-multiple-groups.md b/changelog/unreleased/fix-listing-shares-to-multiple-groups.md new file mode 100644 index 0000000000..6ddb26721c --- /dev/null +++ b/changelog/unreleased/fix-listing-shares-to-multiple-groups.md @@ -0,0 +1,5 @@ +Bugfix: Fix listing shares to multiple groups + +Users can now see the shares to all groups they are a member of. + +https://github.com/cs3org/reva/pull/3741 diff --git a/pkg/share/manager/jsoncs3/jsoncs3.go b/pkg/share/manager/jsoncs3/jsoncs3.go index 06805f255d..2d301ba830 100644 --- a/pkg/share/manager/jsoncs3/jsoncs3.go +++ b/pkg/share/manager/jsoncs3/jsoncs3.go @@ -716,9 +716,14 @@ func (m *Manager) ListReceivedShares(ctx context.Context, filters []*collaborati for ssid, spaceShareIDs := range m.GroupReceivedCache.List(group) { // add a pending entry, the state will be updated // when reading the received shares below if they have already been accepted or denied - rs := receivedsharecache.Space{ - Mtime: spaceShareIDs.Mtime, - States: make(map[string]*receivedsharecache.State, len(spaceShareIDs.IDs)), + var rs *receivedsharecache.Space + var ok bool + if rs, ok = ssids[ssid]; !ok { + rs = &receivedsharecache.Space{ + Mtime: spaceShareIDs.Mtime, + States: make(map[string]*receivedsharecache.State, len(spaceShareIDs.IDs)), + } + ssids[ssid] = rs } for shareid := range spaceShareIDs.IDs { @@ -726,7 +731,6 @@ func (m *Manager) ListReceivedShares(ctx context.Context, filters []*collaborati State: collaboration.ShareState_SHARE_STATE_PENDING, } } - ssids[ssid] = &rs } }