patchCore is a patch's answer without its intervening writes: what an idempotency key stores (TASK-3585); intervening is computed live.
(updated *models.Item, p *itemPatch, pendingFlush bool)
| 386 | // patchCore is a patch's answer without its intervening writes: what an |
| 387 | // idempotency key stores (TASK-3585); intervening is computed live. |
| 388 | func patchCore(updated *models.Item, p *itemPatch, pendingFlush bool) patchResponse { |
| 389 | resp := patchResponse{ |
| 390 | Ref: itemRefOrSlug(*updated), |
| 391 | Seq: updated.Seq, |
| 392 | PatchID: p.id, |
| 393 | UndoOf: p.undoOf, |
| 394 | VersionID: updated.CreatedVersionID, |
| 395 | Rebased: p.rebased(), |
| 396 | AppliedOverSeq: p.baseSeq, |
| 397 | Diff: diff.Unified(p.before, p.after, 3), |
| 398 | } |
| 399 | if pendingFlush { |
| 400 | resp.ContentState = contentOutcomeAppliedPendingFlush |
| 401 | } |
| 402 | return resp |
| 403 | } |
| 404 | |
| 405 | func (s *Server) writePatchResponse(w http.ResponseWriter, updated *models.Item, p *itemPatch, pendingFlush bool) { |
| 406 | resp := patchCore(updated, p, pendingFlush) |
no test coverage detected