mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +02:00
Set doc revised for when section events
Supports new space recency filters.
This commit is contained in:
parent
eb9501014d
commit
e6e5f75ee7
2 changed files with 36 additions and 0 deletions
|
@ -179,6 +179,18 @@ func (s Store) Update(ctx domain.RequestContext, document doc.Document) (err err
|
|||
return
|
||||
}
|
||||
|
||||
// UpdateRevised sets document revision date to UTC now.
|
||||
func (s Store) UpdateRevised(ctx domain.RequestContext, docID string) (err error) {
|
||||
_, err = ctx.Transaction.Exec(s.Bind(`UPDATE dmz_doc SET c_revised=? WHERE c_orgid=? AND c_refid=?`),
|
||||
time.Now().UTC(), ctx.OrgID, docID)
|
||||
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "document.store.UpdateRevised")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateGroup applies same values to all documents with the same group ID.
|
||||
func (s Store) UpdateGroup(ctx domain.RequestContext, d doc.Document) (err error) {
|
||||
_, err = ctx.Transaction.Exec(s.Bind(`UPDATE dmz_doc SET c_name=?, c_desc=? WHERE c_orgid=? AND c_groupid=?`),
|
||||
|
|
|
@ -175,6 +175,9 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
|
|||
ActivityType: activity.TypeCreated})
|
||||
}
|
||||
|
||||
// Update doc revised.
|
||||
h.Store.Document.UpdateRevised(ctx, doc.RefID)
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeSectionAdd)
|
||||
|
@ -492,6 +495,9 @@ func (h *Handler) Update(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
// Update doc revised.
|
||||
h.Store.Document.UpdateRevised(ctx, model.Page.DocumentID)
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
if doc.Lifecycle == workflow.LifecycleLive {
|
||||
|
@ -593,6 +599,9 @@ func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
h.Store.Page.DeletePageRevisions(ctx, pageID)
|
||||
|
||||
// Update doc revised.
|
||||
h.Store.Document.UpdateRevised(ctx, doc.RefID)
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeSectionDelete)
|
||||
|
@ -702,6 +711,9 @@ func (h *Handler) DeletePages(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
// Update doc revised.
|
||||
h.Store.Document.UpdateRevised(ctx, doc.RefID)
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeSectionDelete)
|
||||
|
@ -779,6 +791,9 @@ func (h *Handler) ChangePageSequence(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
// Update doc revised.
|
||||
h.Store.Document.UpdateRevised(ctx, doc.RefID)
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeSectionResequence)
|
||||
|
@ -848,6 +863,9 @@ func (h *Handler) ChangePageLevel(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
// Update doc revised.
|
||||
h.Store.Document.UpdateRevised(ctx, doc.RefID)
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeSectionResequence)
|
||||
|
@ -969,6 +987,9 @@ func (h *Handler) Copy(w http.ResponseWriter, r *http.Request) {
|
|||
ActivityType: activity.TypeCreated})
|
||||
}
|
||||
|
||||
// Update doc revised.
|
||||
h.Store.Document.UpdateRevised(ctx, targetID)
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeSectionCopy)
|
||||
|
@ -1223,6 +1244,9 @@ func (h *Handler) Rollback(w http.ResponseWriter, r *http.Request) {
|
|||
ActivityType: activity.TypeReverted})
|
||||
}
|
||||
|
||||
// Update doc revised.
|
||||
h.Store.Document.UpdateRevised(ctx, doc.RefID)
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeSectionRollback)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue