Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranav Kant <pranav913@gmail.com>2017-10-20 12:26:26 +0300
committerAndras Timar <andras.timar@collabora.com>2017-10-20 12:26:26 +0300
commit72cb1956b0e5f58d6ab0511d26298458352a75a6 (patch)
tree9c5239141a72d630048d36cd177fe5b05c7435ac
parent0434e383ba104b9b983e565a4093b2f48688ba26 (diff)
Start listening for standard post messages and ignore deprecated ones (#126)
New online versions emits both the post messages (the older one with a deprecated flag and newer one without). Ignore if the deprecated flag is mentioned because it means that we would get another post message without deprecated flag.
-rw-r--r--js/documents.js20
1 files changed, 16 insertions, 4 deletions
diff --git a/js/documents.js b/js/documents.js
index 8d10fd23..709c6b45 100644
--- a/js/documents.js
+++ b/js/documents.js
@@ -353,13 +353,25 @@ var documentsMain = {
}
try {
- var msg = JSON.parse(e.data).MessageId;
+ var msg = JSON.parse(e.data);
+ var msgId = msg.MessageId;
+ var args = msg.Values;
+ var deprecated = !!args.Deprecated;
} catch(exc) {
- msg = e.data;
+ msgId = e.data;
}
- if (msg === 'UI_Close' || msg === 'close') {
+
+ if (msgId === 'UI_Close' || msgId === 'close' /* deprecated */) {
+ // If a postmesage API is deprecated, we must ignore it and wait for the standard postmessage
+ // (or it might already have been fired)
+ if (deprecated)
+ return;
+
documentsMain.onClose();
- } else if (msg === 'rev-history') {
+ } else if (msgId === 'UI_FileVersions' || msgId === 'rev-history' /* deprecated */) {
+ if (deprecated)
+ return;
+
documentsMain.UI.showRevHistory(documentsMain.fullPath);
}
});