Fix oo template issues

pull/1/head
yflory 3 years ago
parent 75a8d1acba
commit eb16cd8b73

@ -728,18 +728,26 @@ define([
var optsPut = {};
if (p.type === 'poll') { optsPut.initialState = '{}'; }
// PPP: add password as cryptput option
Cryptput(hash, data.toSave, function (e) {
if (e) { throw new Error(e); }
postMessage("ADD_PAD", {
teamId: data.teamId,
href: href,
title: data.title,
path: ['template']
}, function (obj) {
if (obj && obj.error) { return void cb(obj.error); }
cb();
});
}, optsPut);
Nthen(function (w) {
common.getEdPublic(null, w(function (obj) {
if (obj && obj.error) { return; }
optsPut.owners = [obj];
}));
}).nThen(function () {
Cryptput(hash, data.toSave, function (e) {
if (e) { throw new Error(e); }
postMessage("ADD_PAD", {
teamId: data.teamId,
href: href,
title: data.title,
owners: optsPut.owners,
path: ['template']
}, function (obj) {
if (obj && obj.error) { return void cb(obj.error); }
cb();
});
}, optsPut);
});
};
common.isTemplate = function (href, cb) {

@ -222,6 +222,7 @@ define([
// Make sure a former tab on the same worker doesn't have remaining locks
var checkClients = function (clients) {
if (!clients) { return; }
Object.keys(content.ids).forEach(function (id) {
var tabId = Number(id.slice(33)); // remove the netflux ID and the "-"
if (clients.indexOf(tabId) === -1) {
@ -389,9 +390,14 @@ define([
};
_content.version = NEW_VERSION;
_content.channel = Hash.createChannelId();
_content.ids = {};
sframeChan.query('Q_SAVE_AS_TEMPLATE', {
toSave: JSON.stringify({
content: _content
content: _content,
metadata: {
title: '',
defaultTitle: ev.title
}
}),
title: ev.title
}, function () {

Loading…
Cancel
Save