Added RPC setPadTitleInDrive()

This commit is contained in:
Caleb James DeLisle 2017-08-17 17:34:08 +02:00
parent 3b5af3ea74
commit 0b34ceb0eb
4 changed files with 19 additions and 5 deletions

View file

@ -20,8 +20,10 @@ define([
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);
@ -29,7 +31,7 @@ define([
nThen(function (waitFor) {
SFrameChannel.create(window.top, waitFor(function (sfc) { ctx.sframeChan = sfc; }));
// CpNfInner.start() should be here....
}).nThen(function (waitFor) {
}).nThen(function () {
cb(funcs);
});
} };

View file

@ -34,5 +34,11 @@ define({
// 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
// 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,
});

View file

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

View file

@ -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({
sframeChan: sframeChan,
channel: secret.channel,