mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-09-12 21:58:58 -04:00
graph: expose @libre.graph.tags on driveItems
This commit is contained in:
1 parent
f0515bb28c
commit
11d8b8a382
2 files changed
+27
No files matched your search
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
revactx "github.com/opencloud-eu/reva/v2/pkg/ctx"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storagespace"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/tags"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/utils"
|
||||
|
||||
"github.com/opencloud-eu/opencloud/pkg/log"
|
||||
@@ -458,6 +459,9 @@ func cs3ResourceToDriveItem(logger *log.Logger, publicBaseURL *url.URL, res *sto
|
||||
driveItem.Location = metadataToFacet[libregraph.GeoCoordinates](metadata, "location")
|
||||
driveItem.Photo = metadataToFacet[libregraph.Photo](metadata, "photo")
|
||||
driveItem.LibreGraphMeFollowing = libregraph.PtrBool(metadata[_favoriteMetadataKey] == "1")
|
||||
if t := metadata["tags"]; t != "" {
|
||||
driveItem.LibreGraphTags = tags.New(t).AsSlice()
|
||||
}
|
||||
}
|
||||
|
||||
return driveItem, nil
|
||||
|
||||
@@ -294,6 +294,29 @@ var _ = Describe("Driveitems", func() {
|
||||
Expect(res.Value[0].Audio).To(BeNil())
|
||||
Expect(res.Value[0].Location).To(BeNil())
|
||||
Expect(res.Value[0].LibreGraphMeFollowing).To(BeNil())
|
||||
Expect(res.Value[0].LibreGraphTags).To(BeNil())
|
||||
})
|
||||
|
||||
It("returns tags if metadata is available", func() {
|
||||
gatewayClient.On("ListContainer", mock.Anything, mock.Anything).Return(&provider.ListContainerResponse{
|
||||
Status: status.NewOK(ctx),
|
||||
Infos: []*provider.ResourceInfo{
|
||||
{
|
||||
Type: provider.ResourceType_RESOURCE_TYPE_FILE,
|
||||
Id: &provider.ResourceId{StorageId: "storageid", SpaceId: "spaceid", OpaqueId: "opaqueid"},
|
||||
Etag: "etag",
|
||||
Mtime: utils.TimeToTS(mtime),
|
||||
ArbitraryMetadata: &provider.ArbitraryMetadata{
|
||||
Metadata: map[string]string{
|
||||
"tags": "marketing,important",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, nil)
|
||||
|
||||
res := assertItemsList(1)
|
||||
Expect(res.Value[0].GetLibreGraphTags()).To(ConsistOf("marketing", "important"))
|
||||
})
|
||||
|
||||
It("returns the following state if metadata is available", func() {
|
||||
|
||||
Reference in new issue
Block a user