handle RPC_NOT_READY error for logged out users

This commit is contained in:
ansuz
2017-06-29 11:10:07 +02:00
parent a9f8f42e3c
commit 9b8866ed72
2 changed files with 25 additions and 15 deletions

View File

@@ -164,19 +164,28 @@ define([
Cryptpad.removeLoadingScreen();
$dllabel.append($('<br>'));
$dllabel.append(Cryptpad.fixHTML(metadata.name));
$dllabel.append($('<br>'));
$dllabel.append(Messages._getKey('formattedMB', [sizeMb]));
// don't display the size if you don't know it.
if (typeof(sizeM) === 'number') {
$dllabel.append($('<br>'));
$dllabel.append(Messages._getKey('formattedMB', [sizeMb]));
}
var decrypting = false;
var onClick = function (ev) {
if (decrypting) { return; }
decrypting = true;
displayFile(ev, sizeMb);
};
if (sizeMb < 5) { return void onClick(); }
if (typeof(sizeMb) === 'number' && sizeMb < 5) { return void onClick(); }
$dlform.find('#dl, #progress').click(onClick);
};
Cryptpad.getFileSize(window.location.href, function (e, data) {
if (e) { return void Cryptpad.errorLoadingScreen(e); }
if (e) {
// TODO when GET_FILE_SIZE is made unauthenticated
// you won't need to handle this error (there won't be one)
if (e === 'RPC_NOT_READY') { return todoBigFile(); }
return void Cryptpad.errorLoadingScreen(e);
}
var size = Cryptpad.bytesToMegabytes(data);
return void todoBigFile(size);
});