From b13d31296559e7bc8737c46ea2280f1292c135a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Tue, 21 Mar 2023 17:45:58 +0100 Subject: [PATCH] fix listing shares to multiple groups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- .../fix-listing-shares-to-multiple-groups.md | 5 +++++ pkg/share/manager/jsoncs3/jsoncs3.go | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 changelog/unreleased/fix-listing-shares-to-multiple-groups.md 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 } }