Store a pad in a team drive

This commit is contained in:
yflory
2019-09-13 16:45:07 +02:00
parent be85efcb21
commit b76cef9660
4 changed files with 123 additions and 31 deletions

View File

@@ -687,6 +687,38 @@ define([
});
};
common.storeInTeam = function (data, cb) {
if (!data.href) { return void cb({error: 'EINVAL'}); }
var parsed = Hash.parsePadUrl(data.href);
var secret = Hash.getSecrets(parsed.type, parsed.hash, data.password);
if (!secret || !secret.channel) { return void cb ({error: 'EINVAL'}); }
Nthen(function (waitFor) {
// Set the correct owner and expiration time if we can find them
postMessage('GET_PAD_METADATA', {
channel: secret.channel
}, waitFor(function (obj) {
if (!obj || obj.error) { return; }
data.owners = obj.owners;
data.expire = +obj.expire;
}));
}).nThen(function () {
postMessage("SET_PAD_TITLE", {
teamId: data.teamId,
href: data.href,
title: data.title,
password: data.password,
channel: secret.channel,
path: data.path,
owners: data.owners,
expire: data.expire,
forceSave: 1
}, function (obj) {
if (obj && obj.error) { return void cb(obj.error); }
cb();
});
});
};
// Needed for the secure filepicker app
common.getSecureFilesList = function (query, cb) {
postMessage("GET_SECURE_FILES_LIST", query, function (list) {