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:
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.
|
||||
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])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue