mirror of
https://github.com/documize/community.git
synced 2025-07-19 05:09:42 +02:00
Remove archived versions from version selector
This commit is contained in:
parent
576fd5e604
commit
3d1c8a6c54
1 changed files with 10 additions and 11 deletions
|
@ -667,23 +667,22 @@ func (h *Handler) FetchDocumentData(w http.ResponseWriter, r *http.Request) {
|
||||||
// Get version information for this document.
|
// Get version information for this document.
|
||||||
v := []doc.Version{}
|
v := []doc.Version{}
|
||||||
if len(document.GroupID) > 0 {
|
if len(document.GroupID) > 0 {
|
||||||
// Get versions.
|
// Get versions
|
||||||
vt, err := h.Store.Document.GetVersions(ctx, document.GroupID)
|
vt, err := h.Store.Document.GetVersions(ctx, document.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
response.WriteServerError(w, method, err)
|
response.WriteServerError(w, method, err)
|
||||||
h.Runtime.Log.Error(method, err)
|
h.Runtime.Log.Error(method, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// What about draft document versions?
|
// Determine which document versions user can see.
|
||||||
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.
|
|
||||||
for i := range vt {
|
for i := range vt {
|
||||||
|
// Everyone can see live documents
|
||||||
if vt[i].Lifecycle == workflow.LifecycleLive {
|
if vt[i].Lifecycle == workflow.LifecycleLive {
|
||||||
v = append(v, vt[i])
|
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])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue