Add a default pad in CryptDrive after signing up

This commit is contained in:
yflory 2017-02-16 17:22:45 +01:00
parent 85fe67618c
commit 550c65aae0
4 changed files with 39 additions and 5 deletions

View File

@ -121,5 +121,9 @@ define(['/customize/languageSelector.js',
'</p>',
].join('');
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.driveReadme_h1 + '",["BR",{},[]]]],["UL",{},[["LI",{},["' + messages.driveReadme_li1 + '",["BR",{},[]],["UL",{},[["LI",{},["' + messages.driveReadme_li1_1 + '",["BR",{},[]]]]]]]]]]],' +
'{"metadata":{"defaultTitle":"' + messages.driveReadmeTitle + '","title":"' + messages.driveReadmeTitle + '"}}]';
return messages;
});

View File

@ -448,5 +448,10 @@ define(function () {
' - Your slides are updated in realtime'
].join('');
out.driveReadmeTitle = "What is CryptDrive?";
out.driveReadme_h1 = "Welcome to CryptPad";
out.driveReadme_li1 = "CryptDrive : all your pads sorted in one place";
out.driveReadme_li1_1 = "Tree, trash, unsorted files, etc.";
return out;
});

View File

@ -1871,6 +1871,27 @@ define([
if (typeof(cb) === "function") { cb(); }
}
};
var createReadme = function (proxy, cb) {
if (proxy.initializing) {
console.log('test');
var hash = Cryptpad.createRandomHash();
Get.put(hash, Messages.driveReadme, function (e) {
if (e) { console.error(e); }
var href = '/pad/#' + hash;
proxy.drive[UNSORTED].push(href);
proxy.drive[FILES_DATA].push({
href: href,
title: Messages.driveReadmeTitle,
atime: new Date().toISOString(),
ctime: new Date().toISOString()
});
if (typeof(cb) === "function") { cb(); }
});
delete proxy.initializing;
return;
}
if (typeof(cb) === "function") { cb(); }
};
// don't initialize until the store is ready.
Cryptpad.ready(function () {
@ -1966,10 +1987,12 @@ define([
module.files = proxy;
if (!proxy.drive || typeof(proxy.drive) !== 'object') { proxy.drive = {}; }
migrateAnonDrive(proxy, function () {
initLocalStorage();
init(proxy);
APP.userList.onChange();
Cryptpad.removeLoadingScreen();
createReadme(proxy, function () {
initLocalStorage();
init(proxy);
APP.userList.onChange();
Cryptpad.removeLoadingScreen();
});
});
};
var onDisconnect = function (info) {

View File

@ -1,9 +1,10 @@
define([
'/common/login.js',
'/common/cryptpad-common.js',
'/common/cryptget.js',
'/common/credential.js',
'/bower_components/jquery/dist/jquery.min.js',
], function (Login, Cryptpad) {
], function (Login, Cryptpad, Crypt) {
var $ = window.jQuery;
var APP = window.APP = {
@ -118,6 +119,7 @@ define([
proxy.login_name = uname;
proxy[Cryptpad.displayNameKey] = uname;
proxy.initializing = true;
Cryptpad.whenRealtimeSyncs(result.realtime, function () {
Cryptpad.login(result.userHash, result.userName, function () {