Commit a4a2ec00 authored by Julia Radzhabova's avatar Julia Radzhabova Committed by GitHub

Merge pull request #39 from ONLYOFFICE/feature/set-history-data

Feature/set history data
parents 8b13150d 8b90eb49
......@@ -163,19 +163,27 @@ define([
if (historyStore && data!==null) {
var rev, revisions = historyStore.findRevisions(data.version),
urlGetTime = new Date();
var diff = opts.data.urlDiff || opts.data.changesUrl;
var diff = opts.data.changesUrl,
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<revisions.length; i++) {
rev = revisions[i];
rev.set('url', opts.data.url, {silent: true});
rev.set('url', url, {silent: true});
rev.set('urlDiff', diff, {silent: true});
rev.set('urlGetTime', urlGetTime, {silent: true});
if (opts.data.key) {
rev.set('docId', docId, {silent: true});
rev.set('docIdPrev', docIdPrev, {silent: true});
}
}
}
var hist = new Asc.asc_CVersionHistory();
hist.asc_setUrl(opts.data.url);
hist.asc_setUrl(url);
hist.asc_setUrlChanges(diff);
hist.asc_setDocId(_.isEmpty(diff) ? this.currentDocId : this.currentDocIdPrev);
hist.asc_setDocId(_.isEmpty(diff) ? docId : docIdPrev);
hist.asc_setCurrentChangeId(this.currentChangeId);
hist.asc_setArrColors(this.currentArrColors);
this.api.asc_showRevision(hist);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment