1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-18 20:59:43 +02:00

Remove archived versions from version selector

This commit is contained in:
Harvey Kandola 2023-07-24 11:11:25 -04:00
parent 576fd5e604
commit 3d1c8a6c54

View file

@ -667,23 +667,22 @@ func (h *Handler) FetchDocumentData(w http.ResponseWriter, r *http.Request) {
// Get version information for this document.
v := []doc.Version{}
if len(document.GroupID) > 0 {
// Get versions.
// Get versions
vt, err := h.Store.Document.GetVersions(ctx, document.GroupID)
if err != nil {
response.WriteServerError(w, method, err)
h.Runtime.Log.Error(method, err)
return
}
// What about draft document versions?
if record.DocumentLifecycle {
// We can see and manage document lifecycle so take all versions.
v = vt
} else {
// Only send back LIVE content because user cannot drafts.
// Determine which document versions user can see.
for i := range vt {
// Everyone can see live documents
if vt[i].Lifecycle == workflow.LifecycleLive {
v = append(v, vt[i])
}
// Only lifecycle admins can see draft documents
if vt[i].Lifecycle == workflow.LifecycleDraft && record.DocumentLifecycle {
v = append(v, vt[i])
}
}
}