diff --git a/services/graph/pkg/service/v0/tags.go b/services/graph/pkg/service/v0/tags.go index 40de0be168..57bedfa564 100644 --- a/services/graph/pkg/service/v0/tags.go +++ b/services/graph/pkg/service/v0/tags.go @@ -33,10 +33,10 @@ func (g Graph) GetTags(w http.ResponseWriter, r *http.Request) { return } - tagList := tags.FromList("") + tagList := tags.New("") for _, match := range sr.Matches { for _, tag := range match.Entity.Tags { - tagList.AddList(tag) + tagList.Add(tag) } } @@ -100,9 +100,8 @@ func (g Graph) AssignTags(w http.ResponseWriter, r *http.Request) { currentTags = m["tags"] } - allTags := tags.FromList(currentTags) - newTags := strings.Join(assignment.Tags, ",") - if !allTags.AddList(newTags) { + allTags := tags.New(currentTags) + if !allTags.Add(assignment.Tags...) { errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, "no new tags in createtagsrequest or maximum reached") return } @@ -123,7 +122,7 @@ func (g Graph) AssignTags(w http.ResponseWriter, r *http.Request) { if g.eventsPublisher != nil { ev := events.TagsAdded{ - Tags: newTags, + Tags: strings.Join(assignment.Tags, ","), Ref: &provider.Reference{ ResourceId: &rid, Path: ".", @@ -190,9 +189,8 @@ func (g Graph) UnassignTags(w http.ResponseWriter, r *http.Request) { currentTags = m["tags"] } - allTags := tags.FromList(currentTags) - toDelete := strings.Join(unassignment.Tags, ",") - if !allTags.RemoveList(toDelete) { + allTags := tags.New(currentTags) + if !allTags.Remove(unassignment.Tags...) { errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, "no new tags in createtagsrequest or maximum reached") return } @@ -213,7 +211,7 @@ func (g Graph) UnassignTags(w http.ResponseWriter, r *http.Request) { if g.eventsPublisher != nil { ev := events.TagsRemoved{ - Tags: toDelete, + Tags: strings.Join(unassignment.Tags, ","), Ref: &provider.Reference{ ResourceId: &rid, Path: ".", diff --git a/services/search/pkg/content/basic.go b/services/search/pkg/content/basic.go index 6c8382dffe..ba95ad38ed 100644 --- a/services/search/pkg/content/basic.go +++ b/services/search/pkg/content/basic.go @@ -29,7 +29,7 @@ func (b Basic) Extract(_ context.Context, ri *storageProvider.ResourceInfo) (Doc if m := ri.ArbitraryMetadata.GetMetadata(); m != nil { if t, ok := m["tags"]; ok { - doc.Tags = tags.FromList(t).AsSlice() + doc.Tags = tags.New(t).AsSlice() } } diff --git a/services/webdav/pkg/service/v0/search.go b/services/webdav/pkg/service/v0/search.go index 7ad4258d63..72c08f7fc1 100644 --- a/services/webdav/pkg/service/v0/search.go +++ b/services/webdav/pkg/service/v0/search.go @@ -190,10 +190,7 @@ func matchToPropResponse(ctx context.Context, match *searchmsg.Match) (*propfind propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("d:getcontenttype", match.Entity.MimeType)) propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:permissions", match.Entity.Permissions)) - t := tags.FromList("") - for _, tag := range match.Entity.Tags { - t.AddList(tag) - } + t := tags.New(match.Entity.Tags...) propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:tags", t.AsList())) // those seem empty - bug?