mirror of
https://github.com/documize/community.git
synced 2025-07-22 06:39:43 +02:00
Overhaul the space stats module
Closes #274 All space counters are reset after document and catergory operations.
This commit is contained in:
parent
6b723568d3
commit
fad1de2e41
7 changed files with 1095 additions and 1142 deletions
|
@ -311,6 +311,7 @@ func (h *Handler) Update(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Space.SetStats(ctx, d.SpaceID)
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeDocumentUpdate)
|
||||
|
||||
// Live document indexed for search.
|
||||
|
@ -411,16 +412,9 @@ func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) {
|
|||
ActivityType: activity.TypeDeleted})
|
||||
}
|
||||
|
||||
err = h.Store.Space.DecrementContentCount(ctx, doc.SpaceID)
|
||||
if err != nil {
|
||||
ctx.Transaction.Rollback()
|
||||
response.WriteServerError(w, method, err)
|
||||
h.Runtime.Log.Error(method, err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Space.SetStats(ctx, doc.SpaceID)
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeDocumentDelete)
|
||||
|
||||
go h.Indexer.DeleteDocument(ctx, documentID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue