From d2f1d0c0e96877f3c821cfa138c7fd8c5ef2b3a0 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 25 Sep 2017 16:09:54 +0200 Subject: [PATCH] Fix readme pad not added at registration in sframe drive --- www/common/cryptpad-common.js | 29 +++++++++++++++++++++++++++++ www/newdrive/inner.js | 33 ++------------------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 95ba35f13..863d97d07 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -2236,6 +2236,35 @@ define([ } $iframe.load(w2); //cb); } + }).nThen(function (waitFor) { + if (sessionStorage.createReadme) { + var w = waitFor(); + require(['/common/cryptget.js'], function (Crypt) { + var hash = common.createRandomHash(); + Crypt.put(hash, Messages.driveReadme, function (e) { + if (e) { + console.error("Error while creating the default pad:", e); + return void w(); + } + var href = '/pad/#' + hash; + var data = { + href: href, + title: Messages.driveReadmeTitle, + atime: new Date().toISOString(), + ctime: new Date().toISOString() + }; + common.getFO().pushData(data, function (e, id) { + if (e) { + console.error("Error while creating the default pad:", e); + return void w(); + } + common.getFO().add(id); + w(); + }); + }); + delete sessionStorage.createReadme; + }); + } }).nThen(function (waitFor) { if (sessionStorage.migrateAnonDrive) { var w = waitFor(); diff --git a/www/newdrive/inner.js b/www/newdrive/inner.js index 887be9994..9c1072954 100644 --- a/www/newdrive/inner.js +++ b/www/newdrive/inner.js @@ -2828,32 +2828,6 @@ define([ refresh(); }; - var createReadme = function (proxy, cb) { - if (sessionStorage.createReadme) { - var hash = Cryptpad.createRandomHash(); - Get.put(hash, Messages.driveReadme, function (e) { - if (e) { logError(e); } - var href = '/pad/#' + hash; - var data = { - href: href, - title: Messages.driveReadmeTitle, - atime: new Date().toISOString(), - ctime: new Date().toISOString() - }; - filesOp.pushData(data, function (e, id) { - if (e) { - return void console.error("Error while creating the default pad:", e); - } - filesOp.add(id); - if (typeof(cb) === "function") { cb(); } - }); - }); - delete sessionStorage.createReadme; - return; - } - if (typeof(cb) === "function") { cb(); } - }; - var fmConfig = { noHandlers: true, onUploaded: function (ev, data) { @@ -2880,11 +2854,8 @@ define([ }; APP.FM = common.createFileManager(fmConfig); - createReadme(proxy, function () { - refresh(); - //APP.userList.onChange(); - Cryptpad.removeLoadingScreen(); - }); + refresh(); + Cryptpad.removeLoadingScreen(); }; var setHistory = function (bool, update) {