Preserve chat and cursor channel when importing a template

This commit is contained in:
yflory
2018-12-12 13:48:28 +01:00
parent 1a0344547b
commit f883fb7e04
4 changed files with 25 additions and 6 deletions

View File

@@ -168,12 +168,15 @@ define([
// Chat
var padChatChannel;
// common-ui-elements needs to be able to get the chat channel to put it in metadata when
// importing a template
funcs.getPadChat = function () {
return padChatChannel;
};
funcs.openPadChat = function (saveChanges) {
var md = JSON.parse(JSON.stringify(ctx.metadataMgr.getMetadata()));
//if (md.chat) { delete md.chat; } // Old channel without signing key
// NOTE: "chat2" is also used in cryptpad-common's "useTemplate"
var channel = md.chat2 || Hash.createChannelId();
if (!md.chat2) {
md.chat2 = channel;
@@ -187,6 +190,8 @@ define([
};
var cursorChannel;
// common-ui-elements needs to be able to get the cursor channel to put it in metadata when
// importing a template
funcs.getCursorChannel = function () {
return cursorChannel;
};