Transfer shared folder ownership

pull/1/head
yflory 5 years ago
parent 07fbe6c284
commit 9090002e1f

@ -509,7 +509,7 @@ define([
if (data.href || data.roHref) { if (data.href || data.roHref) {
parsed = Hash.parsePadUrl(data.href || data.roHref); parsed = Hash.parsePadUrl(data.href || data.roHref);
} }
if (owned && data.roHref && parsed.type !== 'drive' && parsed.hashData.type === 'pad') { if (owned && parsed.hashData.type === 'pad') {
var manageOwners = h('button.no-margin', Messages.owner_openModalButton); var manageOwners = h('button.no-margin', Messages.owner_openModalButton);
$(manageOwners).click(function () { $(manageOwners).click(function () {
data.teamId = typeof(owned) !== "boolean" ? owned : undefined; data.teamId = typeof(owned) !== "boolean" ? owned : undefined;

@ -495,18 +495,25 @@ define([
}); });
sframeChan.on('Q_ACCEPT_OWNERSHIP', function (data, cb) { sframeChan.on('Q_ACCEPT_OWNERSHIP', function (data, cb) {
var _data = { var parsed = Utils.Hash.parsePadUrl(data.href);
password: data.password, if (parsed.type === 'drive') {
href: data.href, // Shared folder
channel: data.channel, var secret = Utils.Hash.getSecrets(parsed.type, parsed.hash, data.password);
title: data.title, Cryptpad.addSharedFolder(null, secret, cb);
owners: data.metadata.owners, } else {
expire: data.metadata.expire, var _data = {
forceSave: true password: data.password,
}; href: data.href,
Cryptpad.setPadTitle(_data, function (err) { channel: data.channel,
cb({error: err}); title: data.title,
}); owners: data.metadata.owners,
expire: data.metadata.expire,
forceSave: true
};
Cryptpad.setPadTitle(_data, function (err) {
cb({error: err});
});
}
// Also add your mailbox to the metadata object // Also add your mailbox to the metadata object
var padParsed = Utils.Hash.parsePadUrl(data.href); var padParsed = Utils.Hash.parsePadUrl(data.href);

Loading…
Cancel
Save