Skip to content

Commit

Permalink
update test for issue-ocis-reva-260
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Nov 6, 2020
1 parent 887e82f commit d0c6779
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 68 deletions.
2 changes: 2 additions & 0 deletions changelog/unreleased/ocs-filter-path-and-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ Bugfix: filter share with me requests

The OCS API now properly filters share with me requests by path and by share status (pending, accepted, rejected, all)

https://github.com/owncloud/ocis-reva/issues/260
https://github.com/owncloud/ocis-reva/issues/311
https://github.com/cs3org/reva/pull/1301
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {

ctx := r.Context()

var info *provider.ResourceInfo
var pinfo *provider.ResourceInfo
p := r.URL.Query().Get("path")
// we need to lookup the resource id so we can filter the list of shares later
if p != "" {
Expand Down Expand Up @@ -732,7 +732,7 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {
return
}

info = statRes.GetInfo()
pinfo = statRes.GetInfo()
}

lrsReq := collaboration.ListReceivedSharesRequest{}
Expand All @@ -754,14 +754,25 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {
lrsRes.GetShares()

shares := make([]*conversions.ShareData, 0)

var info *provider.ResourceInfo
// TODO(refs) filter out "invalid" shares
for _, rs := range lrsRes.GetShares() {

if stateFilter != ocsStateUnknown && rs.GetState() != stateFilter {
continue
}

if info == nil {
if pinfo != nil {
// check if the shared resource matches the path resource
if rs.Share.ResourceId.StorageId != pinfo.GetId().StorageId ||
rs.Share.ResourceId.OpaqueId != pinfo.GetId().OpaqueId {
// try next share
continue
}
// we can reuse the stat info
info = pinfo
} else {
// we need to do a stat call
statRequest := provider.StatRequest{
Ref: &provider.Reference{
Spec: &provider.Reference_Id{
Expand All @@ -777,9 +788,6 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {
}

info = statRes.GetInfo()
} else if rs.Share.ResourceId.StorageId != info.GetId().StorageId ||
rs.Share.ResourceId.OpaqueId != info.GetId().OpaqueId {
continue
}

data, err := conversions.UserShare2ShareData(r.Context(), rs.Share)
Expand Down
4 changes: 0 additions & 4 deletions tests/acceptance/expected-failures-on-EOS-storage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,6 @@ apiSharePublicLink1/createPublicLinkShare.feature:779
# https://github.com/owncloud/core/issues/37605 Public cannot upload file with mtime set on a public link share with new version of WebDAV API
apiSharePublicLink1/createPublicLinkShare.feature:793
#
# https://github.com/owncloud/ocis-reva/issues/311 Deleting a public link after renaming a file
apiSharePublicLink1/deletePublicLinkShare.feature:37
apiSharePublicLink1/deletePublicLinkShare.feature:38
#
# https://github.com/owncloud/ocis-reva/issues/373 copying a folder within a public link folder to folder with same name as an already existing file overwrites the parent file
apiSharePublicLink2/copyFromPublicLink.feature:60
#
Expand Down
6 changes: 0 additions & 6 deletions tests/acceptance/expected-failures-on-OCIS-storage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ apiShareManagementToShares/acceptShares.feature:160
apiShareManagementToShares/acceptShares.feature:162
apiShareManagementToShares/acceptShares.feature:175
apiShareManagementToShares/acceptShares.feature:196
apiShareManagementToShares/acceptShares.feature:216
apiShareManagementToShares/acceptShares.feature:223
apiShareManagementToShares/acceptShares.feature:249
apiShareManagementToShares/acceptShares.feature:270
Expand Down Expand Up @@ -315,11 +314,6 @@ apiShareManagementBasicToShares/deleteShareFromShares.feature:182
apiShareManagementBasicToShares/deleteShareFromShares.feature:183
apiShareManagementBasicToShares/deleteShareFromShares.feature:184
#
# https://github.com/owncloud/ocis-reva/issues/260 Sharee retrieves the information about a share -but gets response containing all the shares
#
apiShareOperationsToShares/accessToShare.feature:55
apiShareOperationsToShares/accessToShare.feature:56
#
# https://github.com/owncloud/ocis-reva/issues/262 Shares are not deleted when user is deleted
#
apiShareOperationsToShares/gettingShares.feature:24
Expand Down
11 changes: 0 additions & 11 deletions tests/acceptance/expected-failures-on-OWNCLOUD-storage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ apiShareManagementToShares/acceptShares.feature:160
apiShareManagementToShares/acceptShares.feature:162
apiShareManagementToShares/acceptShares.feature:175
apiShareManagementToShares/acceptShares.feature:196
apiShareManagementToShares/acceptShares.feature:216
apiShareManagementToShares/acceptShares.feature:223
apiShareManagementToShares/acceptShares.feature:249
apiShareManagementToShares/acceptShares.feature:270
Expand Down Expand Up @@ -305,11 +304,6 @@ apiShareManagementBasicToShares/deleteShareFromShares.feature:182
apiShareManagementBasicToShares/deleteShareFromShares.feature:183
apiShareManagementBasicToShares/deleteShareFromShares.feature:184
#
# https://github.com/owncloud/ocis-reva/issues/260 Sharee retrieves the information about a share -but gets response containing all the shares
#
apiShareOperationsToShares/accessToShare.feature:55
apiShareOperationsToShares/accessToShare.feature:56
#
# https://github.com/owncloud/ocis-reva/issues/262 Shares are not deleted when user is deleted
#
apiShareOperationsToShares/gettingShares.feature:24
Expand Down Expand Up @@ -475,11 +469,6 @@ apiSharePublicLink1/createPublicLinkShare.feature:730
apiSharePublicLink1/createPublicLinkShare.feature:733
apiSharePublicLink1/createPublicLinkShare.feature:742
#
# https://github.com/owncloud/ocis-reva/issues/311 Deleting a public link after renaming a file
#
apiSharePublicLink1/deletePublicLinkShare.feature:37
apiSharePublicLink1/deletePublicLinkShare.feature:38
#
# https://github.com/owncloud/ocis-reva/issues/373 copying a folder within a public link folder to folder with same name as an already existing file overwrites the parent file
#
apiSharePublicLink2/copyFromPublicLink.feature:60
Expand Down

This file was deleted.

0 comments on commit d0c6779

Please sign in to comment.