Added RPC setPadTitleInDrive()

pull/1/head
Caleb James DeLisle 7 years ago
parent 3b5af3ea74
commit 0b34ceb0eb

@ -20,8 +20,10 @@ define([
return ctx.cpNfInner.metadataMgr.getPrivateData().accountName; return ctx.cpNfInner.metadataMgr.getPrivateData().accountName;
}; };
funcs.setTitle = function (title /*:string*/, cb) { funcs.setPadTitleInDrive = function (title, cb) {
ctx.sframeChan.query('Q_SET_PAD_TITLE_IN_DRIVE', title, function (err) {
if (cb) { cb(err); }
});
}; };
Object.freeze(funcs); Object.freeze(funcs);
@ -29,7 +31,7 @@ define([
nThen(function (waitFor) { nThen(function (waitFor) {
SFrameChannel.create(window.top, waitFor(function (sfc) { ctx.sframeChan = sfc; })); SFrameChannel.create(window.top, waitFor(function (sfc) { ctx.sframeChan = sfc; }));
// CpNfInner.start() should be here.... // CpNfInner.start() should be here....
}).nThen(function (waitFor) { }).nThen(function () {
cb(funcs); cb(funcs);
}); });
} }; } };

@ -34,5 +34,11 @@ define({
// Called from the outside, this informs the inside whenever the user's data has been changed. // Called from the outside, this informs the inside whenever the user's data has been changed.
// The argument is the object representing the content of the user profile minus the netfluxID // The argument is the object representing the content of the user profile minus the netfluxID
// which changes per-reconnect. // which changes per-reconnect.
'EV_METADATA_UPDATE': true 'EV_METADATA_UPDATE': true,
// Takes one argument only, the title to set for the CURRENT pad which the user is looking at.
// This changes the pad title in drive ONLY, the pad title needs to be changed inside of the
// iframe and synchronized with the other users. This will not trigger a EV_METADATA_UPDATE
// because the metadata contained in EV_METADATA_UPDATE does not contain the pad title.
'Q_SET_PAD_TITLE_IN_DRIVE': true,
}); });

@ -754,7 +754,7 @@ define([
$(waitFor(function () { $(waitFor(function () {
Cryptpad.addLoadingScreen(); Cryptpad.addLoadingScreen();
})); }));
SFCommon.create(waitFor(function (c) { common = c; })); SFCommon.create(waitFor(function (c) { module.common = common = c; }));
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
Ckeditor.config.toolbarCanCollapse = true; Ckeditor.config.toolbarCanCollapse = true;
if (screen.height < 800) { if (screen.height < 800) {

@ -65,6 +65,12 @@ define([
} }
}); });
sframeChan.on('Q_SET_PAD_TITLE_IN_DRIVE', function (newTitle, cb) {
Cryptpad.renamePad(newTitle, undefined, function (err) {
if (err) { cb('ERROR'); } else { cb(); }
});
});
CpNfOuter.start({ CpNfOuter.start({
sframeChan: sframeChan, sframeChan: sframeChan,
channel: secret.channel, channel: secret.channel,

Loading…
Cancel
Save