Commit 2eb46fa2 authored by Julia Radzhabova's avatar Julia Radzhabova

[DE] Check if token for history revision is expired.

parent 52e9b6a6
...@@ -57,6 +57,7 @@ define([ ...@@ -57,6 +57,7 @@ define([
this.currentArrColors = []; this.currentArrColors = [];
this.currentDocId = ''; this.currentDocId = '';
this.currentDocIdPrev = ''; this.currentDocIdPrev = '';
this.currentRev = 0;
}, },
events: { events: {
...@@ -74,6 +75,7 @@ define([ ...@@ -74,6 +75,7 @@ define([
setApi: function(api) { setApi: function(api) {
this.api = api; this.api = api;
this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this)); this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this));
this.api.asc_registerCallback('asc_onExpiredToken', _.bind(this.onExpiredToken, this));
return this; return this;
}, },
...@@ -127,6 +129,7 @@ define([ ...@@ -127,6 +129,7 @@ define([
this.currentArrColors = record.get('arrColors'); this.currentArrColors = record.get('arrColors');
this.currentDocId = record.get('docId'); this.currentDocId = record.get('docId');
this.currentDocIdPrev = record.get('docIdPrev'); this.currentDocIdPrev = record.get('docIdPrev');
this.currentRev = rev;
if ( _.isEmpty(url) || (urlGetTime - record.get('urlGetTime') > 5 * 60000)) { if ( _.isEmpty(url) || (urlGetTime - record.get('urlGetTime') > 5 * 60000)) {
_.delay(function() { _.delay(function() {
...@@ -142,6 +145,7 @@ define([ ...@@ -142,6 +145,7 @@ define([
hist.asc_setCurrentChangeId(this.currentChangeId); hist.asc_setCurrentChangeId(this.currentChangeId);
hist.asc_setArrColors(this.currentArrColors); hist.asc_setArrColors(this.currentArrColors);
hist.asc_setToken(token); hist.asc_setToken(token);
hist.asc_setIsRequested(false);
this.api.asc_showRevision(hist); this.api.asc_showRevision(hist);
var commentsController = this.getApplication().getController('Common.Controllers.Comments'); var commentsController = this.getApplication().getController('Common.Controllers.Comments');
...@@ -191,6 +195,7 @@ define([ ...@@ -191,6 +195,7 @@ define([
hist.asc_setCurrentChangeId(this.currentChangeId); hist.asc_setCurrentChangeId(this.currentChangeId);
hist.asc_setArrColors(this.currentArrColors); hist.asc_setArrColors(this.currentArrColors);
hist.asc_setToken(token); hist.asc_setToken(token);
hist.asc_setIsRequested(true);
this.api.asc_showRevision(hist); this.api.asc_showRevision(hist);
var commentsController = this.getApplication().getController('Common.Controllers.Comments'); var commentsController = this.getApplication().getController('Common.Controllers.Comments');
...@@ -199,6 +204,12 @@ define([ ...@@ -199,6 +204,12 @@ define([
} }
}, },
onExpiredToken: function() {
_.delay(function() {
Common.Gateway.requestHistoryData(this.currentRev); // получаем url-ы для ревизий
}, 10);
},
onClickBackToDocument: function () { onClickBackToDocument: function () {
// reload editor // reload editor
Common.Gateway.requestHistoryClose(); Common.Gateway.requestHistoryClose();
......
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