From 8b90eb49259d296a2d23187a0c0c9ae7caac0a04 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 31 Oct 2016 15:01:45 +0300 Subject: [PATCH] [DE] Changed format for data in setHistoryData (+ support for old format). { version: '...', url: '...', key: '...', changesUrl: '...', previous: { url: '...', key: '...', } } --- apps/common/main/lib/controller/History.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/apps/common/main/lib/controller/History.js b/apps/common/main/lib/controller/History.js index f01eb8f7e..18640494f 100644 --- a/apps/common/main/lib/controller/History.js +++ b/apps/common/main/lib/controller/History.js @@ -164,14 +164,9 @@ define([ var rev, revisions = historyStore.findRevisions(data.version), urlGetTime = new Date(); var diff = opts.data.changesUrl, - url, docId; - if (opts.data.current && opts.data.previous) { - url = _.isEmpty(diff) ? opts.data.current.url : opts.data.previous.url; - docId = _.isEmpty(diff) ? opts.data.current.key : opts.data.previous.key; - } else { - url = opts.data.url; - docId = _.isEmpty(diff) ? this.currentDocId : this.currentDocIdPrev; - } + url = (!_.isEmpty(diff) && opts.data.previous) ? opts.data.previous.url : opts.data.url, + docId = opts.data.key ? opts.data.key : this.currentDocId, + docIdPrev = opts.data.previous && opts.data.previous.key ? opts.data.previous.key : this.currentDocIdPrev; if (revisions && revisions.length>0) { for(var i=0; i