From 2eb46fa26153a08091758d693b025c4cea54e1b7 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 14 Mar 2017 14:08:02 +0300 Subject: [PATCH] [DE] Check if token for history revision is expired. --- apps/common/main/lib/controller/History.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apps/common/main/lib/controller/History.js b/apps/common/main/lib/controller/History.js index e5e2f815a..02a71a575 100644 --- a/apps/common/main/lib/controller/History.js +++ b/apps/common/main/lib/controller/History.js @@ -57,6 +57,7 @@ define([ this.currentArrColors = []; this.currentDocId = ''; this.currentDocIdPrev = ''; + this.currentRev = 0; }, events: { @@ -74,6 +75,7 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this)); + this.api.asc_registerCallback('asc_onExpiredToken', _.bind(this.onExpiredToken, this)); return this; }, @@ -127,6 +129,7 @@ define([ this.currentArrColors = record.get('arrColors'); this.currentDocId = record.get('docId'); this.currentDocIdPrev = record.get('docIdPrev'); + this.currentRev = rev; if ( _.isEmpty(url) || (urlGetTime - record.get('urlGetTime') > 5 * 60000)) { _.delay(function() { @@ -142,6 +145,7 @@ define([ hist.asc_setCurrentChangeId(this.currentChangeId); hist.asc_setArrColors(this.currentArrColors); hist.asc_setToken(token); + hist.asc_setIsRequested(false); this.api.asc_showRevision(hist); var commentsController = this.getApplication().getController('Common.Controllers.Comments'); @@ -191,6 +195,7 @@ define([ hist.asc_setCurrentChangeId(this.currentChangeId); hist.asc_setArrColors(this.currentArrColors); hist.asc_setToken(token); + hist.asc_setIsRequested(true); this.api.asc_showRevision(hist); var commentsController = this.getApplication().getController('Common.Controllers.Comments'); @@ -199,6 +204,12 @@ define([ } }, + onExpiredToken: function() { + _.delay(function() { + Common.Gateway.requestHistoryData(this.currentRev); // получаем url-ы для ревизий + }, 10); + }, + onClickBackToDocument: function () { // reload editor Common.Gateway.requestHistoryClose();