From 9bb1a7b790e4ca6e33effff5138eb6b9e4536f3a Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 14 Apr 2021 09:26:09 +0530 Subject: [PATCH] don't create a readme in users' drives on registration --- customize.dist/login.js | 8 -------- customize.dist/messages.js | 4 ---- www/common/cryptpad-common.js | 10 ---------- www/common/outer/async-store.js | 32 ------------------------------- www/common/outer/store-rpc.js | 1 - www/common/sframe-common-outer.js | 1 - 6 files changed, 56 deletions(-) diff --git a/customize.dist/login.js b/customize.dist/login.js index 035a11d72..8b15cdcd3 100644 --- a/customize.dist/login.js +++ b/customize.dist/login.js @@ -135,10 +135,6 @@ define([ Exports.mergeAnonDrive = 1; }; - var setCreateReadme = function () { - Exports.createReadme = 1; - }; - Exports.loginOrRegister = function (uname, passwd, isRegister, shouldImport, cb) { if (typeof(cb) !== 'function') { return; } @@ -372,7 +368,6 @@ define([ proxy.curvePrivate = opt.curvePrivate; proxy.login_name = uname; proxy[Constants.displayNameKey] = uname; - setCreateReadme(); if (shouldImport) { setMergeAnonDrive(); } else { @@ -436,9 +431,6 @@ define([ if (Exports.mergeAnonDrive) { loginOpts.mergeAnonDrive = 1; } - if (Exports.createReadme) { - loginOpts.createReadme = 1; - } h = Hash.getLoginURL(h, loginOpts); var parser = document.createElement('a'); diff --git a/customize.dist/messages.js b/customize.dist/messages.js index b2a264b70..977405db1 100755 --- a/customize.dist/messages.js +++ b/customize.dist/messages.js @@ -120,10 +120,6 @@ define(req, function(AppConfig, Default, Language) { } }; - messages.driveReadme = '["BODY",{"class":"cke_editable cke_editable_themed cke_contents_ltr cke_show_borders","contenteditable":"true","spellcheck":"false","style":"color: rgb(51, 51, 51);"},' + - '[["H1",{},["'+messages.readme_welcome+'"]],["P",{},["'+messages.readme_p1+'"]],["P",{},["'+messages.readme_p2+'"]],["HR",{},[]],["H2",{},["'+messages.readme_cat1+'",["BR",{},[]]]],["UL",{},[["LI",{},["'+messages._getKey("readme_cat1_l1", ['",["STRONG",{},["'+messages.newButton+'"]],"', '",["STRONG",{},["'+messages.type.pad+'"]],"'])+'"]],["LI",{},["'+messages.readme_cat1_l2+'"]],["LI",{},["'+messages._getKey("readme_cat1_l3", ['",["STRONG",{},["'+messages.fm_unsortedName+'"]],"'])+'",["UL",{},[["LI",{},["'+messages._getKey("readme_cat1_l3_l1", ['",["STRONG",{},["'+messages.fm_rootName+'"]],"'])+'"]],["LI",{},["'+messages.readme_cat1_l3_l2+'"]]]]]],["LI",{},["'+messages._getKey("readme_cat1_l4", ['",["STRONG",{},["'+messages.fm_trashName+'"]],"'])+'",["BR",{},[]]]]]],["P",{},[["BR",{},[]]]],["H2",{},["'+messages.readme_cat2+'",["BR",{},[]]]],["UL",{},[["LI",{},["'+messages._getKey("readme_cat2_l1", ['",["STRONG",{},["'+messages.shareButton+'"]],"', '",["STRONG",{},["'+messages.edit+'"]],"', '",["STRONG",{},["'+messages.view+'"]],"'])+'"]],["LI",{},["'+messages.readme_cat2_l2+'"]]]],["P",{},[["BR",{},[]]]],["H2",{},["'+messages.readme_cat3+'"]],["UL",{},[["LI",{},["'+messages.readme_cat3_l1+'"]],["LI",{},["'+messages.readme_cat3_l2+'"]],["LI",{},["'+messages.readme_cat3_l3+'",["BR",{},[]]]]]]],' + - '{"metadata":{"defaultTitle":"' + messages.driveReadmeTitle + '","title":"' + messages.driveReadmeTitle + '"}}]'; - return messages; }); diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index b639eebab..04dabb02d 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -2551,16 +2551,6 @@ define([ console.log('onLogout: disconnect'); postMessage("DISCONNECT"); }); - }).nThen(function (waitFor) { - if (common.createReadme || sessionStorage.createReadme) { - var data = { - driveReadme: Messages.driveReadme, - driveReadmeTitle: Messages.driveReadmeTitle, - }; - postMessage("CREATE_README", data, waitFor(function (e) { - if (e && e.error) { return void console.error(e.error); } - })); - } }).nThen(function (waitFor) { if (common.migrateAnonDrive || sessionStorage.migrateAnonDrive) { common.mergeAnonDrive(waitFor()); diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index b7bf479f3..0dd2b0613 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -879,38 +879,6 @@ define([ }); }; - /** - * add a "What is CryptPad?" pad in the drive - * data - * - driveReadme - * - driveReadmeTitle - */ - Store.createReadme = function (clientId, data, cb) { - require(['/common/cryptget.js'], function (Crypt) { - var hash = Hash.createRandomHash('pad'); - Crypt.put(hash, data.driveReadme, function (e) { - if (e) { - return void cb({ error: "Error while creating the default pad:"+ e}); - } - var href = '/pad/#' + hash; - var channel = Hash.hrefToHexChannelId(href, null); - var fileData = { - href: href, - channel: channel, - title: data.driveReadmeTitle, - owners: [ store.proxy.edPublic ], - readme: true - }; - Store.addPad(clientId, fileData, cb); - }, { - metadata: { - owners: [ store.proxy.edPublic ], - }, - }); - }); - }; - - /** * Merge the anonymous drive into the user drive at registration * data diff --git a/www/common/outer/store-rpc.js b/www/common/outer/store-rpc.js index c4d1d1301..0ad6e3c40 100644 --- a/www/common/outer/store-rpc.js +++ b/www/common/outer/store-rpc.js @@ -11,7 +11,6 @@ define([ // Ready CONNECT: Store.init, DISCONNECT: Store.disconnect, - CREATE_README: Store.createReadme, MIGRATE_ANON_DRIVE: Store.migrateAnonDrive, PING: function (cId, data, cb) { cb(); }, CACHE_DISABLE: Store.disableCache, diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 100ba7d72..dde533e9f 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -212,7 +212,6 @@ define([ var options = parsed.getOptions(); if (options.loginOpts) { var loginOpts = Utils.Hash.decodeDataOptions(options.loginOpts); - if (loginOpts.createReadme) { Cryptpad.createReadme = true; } if (loginOpts.mergeAnonDrive) { Cryptpad.migrateAnonDrive = true; } // Remove newPadOpts from the hash delete options.loginOpts;