Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
ansuz 5 years ago
commit 71e44f46c7

@ -314,11 +314,21 @@ define([
var newPad = false; var newPad = false;
if (newContentStr === '') { newPad = true; } if (newContentStr === '') { newPad = true; }
var privateDat = cpNfInner.metadataMgr.getPrivateData();
var type = privateDat.app;
// contentUpdate may be async so we need an nthen here // contentUpdate may be async so we need an nthen here
nThen(function (waitFor) { nThen(function (waitFor) {
if (!newPad) { if (!newPad) {
var newContent = JSON.parse(newContentStr); var newContent = JSON.parse(newContentStr);
cpNfInner.metadataMgr.updateMetadata(extractMetadata(newContent)); var metadata = extractMetadata(newContent);
if (metadata && typeof(metadata.type) !== 'undefined' && metadata.type !== type) {
var errorText = Messages.typeError;
UI.errorLoadingScreen(errorText);
waitFor.abort();
return;
}
cpNfInner.metadataMgr.updateMetadata(metadata);
newContent = normalize(newContent); newContent = normalize(newContent);
contentUpdate(newContent, waitFor); contentUpdate(newContent, waitFor);
} else { } else {
@ -356,8 +366,6 @@ define([
UI.removeLoadingScreen(emitResize); UI.removeLoadingScreen(emitResize);
var privateDat = cpNfInner.metadataMgr.getPrivateData();
var type = privateDat.app;
if (AppConfig.textAnalyzer && textContentGetter) { if (AppConfig.textAnalyzer && textContentGetter) {
AppConfig.textAnalyzer(textContentGetter, privateDat.channel); AppConfig.textAnalyzer(textContentGetter, privateDat.channel);
} }

Loading…
Cancel
Save