1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-21 06:09:42 +02:00

Copt document categories when copying document

This commit is contained in:
McMatts 2018-04-04 14:38:04 +01:00
parent e19e3682b7
commit 2579382280

View file

@ -142,6 +142,25 @@ func CopyDocument(ctx domain.RequestContext, s domain.Store, documentID string)
} }
} }
cats, err := s.Category.GetDocumentCategoryMembership(ctx, documentID)
if err != nil {
err = errors.Wrap(err, "unable to add copied page")
return
}
for ci := range cats {
cm := category.Member{}
cm.DocumentID = newDocumentID
cm.CategoryID = cats[ci].RefID
cm.OrgID = ctx.OrgID
cm.RefID = uniqueid.Generate()
s.Category.AssociateDocument(ctx, cm)
if err != nil {
err = errors.Wrap(err, "unable to add copied page")
return
}
}
return return
} }