mirror of
https://github.com/documize/community.git
synced 2025-07-21 22:29:41 +02:00
Copt document categories when copying document
This commit is contained in:
parent
e19e3682b7
commit
2579382280
1 changed files with 19 additions and 0 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue