Remove diff summary from document history sidebar.

Cause of occassional memory leaks and downtime :(
This commit is contained in:
Tom Moor
2018-11-23 11:12:14 -08:00
parent 36fd81d190
commit 67cd250316
7 changed files with 4 additions and 97 deletions

View File

@@ -231,9 +231,7 @@ router.post('documents.revisions', auth(), pagination(), async ctx => {
});
const data = await Promise.all(
revisions.map((revision, index) =>
presentRevision(ctx, revision, revisions[index + 1])
)
revisions.map((revision, index) => presentRevision(ctx, revision))
);
ctx.body = {

View File

@@ -1,25 +1,8 @@
// @flow
import * as JSDiff from 'diff';
import { Revision } from '../models';
import presentUser from './user';
function counts(changes) {
return changes.reduce(
(acc, change) => {
if (change.added) acc.added += change.value.length;
if (change.removed) acc.removed += change.value.length;
return acc;
},
{
added: 0,
removed: 0,
}
);
}
function present(ctx: Object, revision: Revision, previous?: Revision) {
const prev = previous ? previous.text : '';
function present(ctx: Object, revision: Revision) {
return {
id: revision.id,
documentId: revision.documentId,
@@ -27,7 +10,6 @@ function present(ctx: Object, revision: Revision, previous?: Revision) {
text: revision.text,
createdAt: revision.createdAt,
createdBy: presentUser(ctx, revision.user),
diff: counts(JSDiff.diffChars(prev, revision.text)),
};
}