adjust for tags pkg

Signed-off-by: jkoberg <jkoberg@owncloud.com>

tmp

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2022-12-23 10:43:23 +01:00
parent 6b374694d6
commit 837eff9017
3 changed files with 10 additions and 15 deletions

View File

@@ -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: ".",

View File

@@ -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()
}
}

View File

@@ -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?