implement more reliable check for whether a channel on the server is new

This commit is contained in:
ansuz
2017-12-22 16:24:17 +01:00
parent b6430d640e
commit 869909b101
5 changed files with 64 additions and 7 deletions

View File

@@ -140,12 +140,10 @@ define([
}).nThen(function (waitFor) {
// Check if the pad exists on server
if (!window.location.hash) { isNewFile = true; return; }
Cryptpad.getFileSize(window.location.href, waitFor(function (err, size) {
if (typeof(size) === 'number' && size >= 108) {
isNewFile = false;
return;
}
isNewFile = true;
Cryptpad.isNewChannel(window.location.href, waitFor(function (e, isNew) {
if (e) { return console.error(e); }
isNewFile = Boolean(isNew);
}));
}).nThen(function () {
var readOnly = secret.keys && !secret.keys.editKeyStr;