Upload owned files

This commit is contained in:
yflory
2018-05-29 19:42:20 +02:00
parent a6bac8ae41
commit 93ecc06964
6 changed files with 166 additions and 14 deletions

View File

@@ -230,9 +230,18 @@ define([
});
};
Store.uploadComplete = function (id, cb) {
Store.uploadComplete = function (data, cb) {
if (!store.rpc) { return void cb({error: 'RPC_NOT_READY'}); }
store.rpc.uploadComplete(id, function (err, res) {
if (data.owned) {
// Owned file
store.rpc.ownedUploadComplete(data.id, function (err, res) {
if (err) { return void cb({error:err}); }
cb(res);
});
return;
}
// Normal upload
store.rpc.uploadComplete(data.id, function (err, res) {
if (err) { return void cb({error:err}); }
cb(res);
});
@@ -678,6 +687,7 @@ define([
if (Store.channel && Store.channel.wc && channel === Store.channel.wc.id) {
owners = Store.channel.data.owners || undefined;
}
var expire;
if (Store.channel && Store.channel.wc && channel === Store.channel.wc.id) {
expire = +Store.channel.data.expire || undefined;
@@ -726,7 +736,11 @@ define([
contains = true;
pad.atime = +new Date();
pad.title = title;
pad.owners = owners;
if (owners || h.type !== "file") {
// OWNED_FILES
// Never remove owner for files
pad.owners = owners;
}
pad.expire = expire;
// If the href is different, it means we have a stronger one