Fetches the body of a revision as JSON, or nil if it's not available.
(ctx context.Context, revid string, loader RevLoaderFunc)
| 793 | |
| 794 | // Fetches the body of a revision as JSON, or nil if it's not available. |
| 795 | func (doc *Document) getRevisionBodyJSON(ctx context.Context, revid string, loader RevLoaderFunc) []byte { |
| 796 | var bodyJSON []byte |
| 797 | if revid == doc.GetRevTreeID() { |
| 798 | var marshalErr error |
| 799 | bodyJSON, marshalErr = doc.BodyBytes(ctx) |
| 800 | if marshalErr != nil { |
| 801 | base.WarnfCtx(ctx, "Marshal error when retrieving active current revision body: %v", marshalErr) |
| 802 | } |
| 803 | } else { |
| 804 | bodyJSON, _ = doc.History.getRevisionBody(revid, loader) |
| 805 | } |
| 806 | return bodyJSON |
| 807 | } |
| 808 | |
| 809 | func (doc *Document) removeRevisionBody(ctx context.Context, revID string) { |
| 810 | removedBodyKey := doc.History.removeRevisionBody(ctx, revID) |
no test coverage detected