Merge branch 'staging' into unifiedMetadata
This commit is contained in:
@@ -201,6 +201,14 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
// Hide duplicates when receiving a SUPPORT_MESSAGE notification
|
||||
var supportMessage = false;
|
||||
handlers['SUPPORT_MESSAGE'] = function (ctx, box, data, cb) {
|
||||
if (supportMessage) { return void cb(true); }
|
||||
supportMessage = true;
|
||||
cb();
|
||||
};
|
||||
|
||||
// Incoming edit rights request: add data before sending it to inner
|
||||
handlers['REQUEST_PAD_ACCESS'] = function (ctx, box, data, cb) {
|
||||
var msg = data.msg;
|
||||
@@ -214,17 +222,19 @@ define([
|
||||
if (!res.length) { return void cb(true); }
|
||||
|
||||
var edPublic = ctx.store.proxy.edPublic;
|
||||
var title;
|
||||
var title, href;
|
||||
if (!res.some(function (obj) {
|
||||
if (obj.data &&
|
||||
Array.isArray(obj.data.owners) && obj.data.owners.indexOf(edPublic) !== -1 &&
|
||||
obj.data.href) {
|
||||
href = obj.data.href;
|
||||
title = obj.data.filename || obj.data.title;
|
||||
return true;
|
||||
}
|
||||
})) { return void cb(true); }
|
||||
|
||||
content.title = title;
|
||||
content.href = href;
|
||||
cb(false);
|
||||
};
|
||||
|
||||
|
||||
@@ -245,8 +245,11 @@ proxy.mailboxes = {
|
||||
});
|
||||
box.queue = [];
|
||||
};
|
||||
var lastReceivedHash; // Don't send a duplicate of the last known hash on reconnect
|
||||
box.onMessage = cfg.onMessage = function (msg, user, vKey, isCp, hash, author) {
|
||||
if (hash === m.lastKnownHash) { return; }
|
||||
if (hash === lastReceivedHash) { return; }
|
||||
lastReceivedHash = hash;
|
||||
try {
|
||||
msg = JSON.parse(msg);
|
||||
} catch (e) {
|
||||
@@ -364,6 +367,7 @@ proxy.mailboxes = {
|
||||
txid: txid,
|
||||
complete: true
|
||||
}, [req.cId]);
|
||||
delete ctx.req[txid];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -506,8 +506,14 @@ define([
|
||||
var fixRoot = function (elem) {
|
||||
if (typeof(files[ROOT]) !== "object") { debug("ROOT was not an object"); files[ROOT] = {}; }
|
||||
var element = elem || files[ROOT];
|
||||
if (!element) { return console.error("Invalid element in root"); }
|
||||
var nbMetadataFolders = 0;
|
||||
for (var el in element) {
|
||||
if (element[el] === null) {
|
||||
console.error('element[%s] is null', el);
|
||||
delete element[el];
|
||||
continue;
|
||||
}
|
||||
if (exp.isFolderData(element[el])) {
|
||||
if (nbMetadataFolders !== 0) {
|
||||
debug("Multiple metadata files in folder");
|
||||
|
||||
Reference in New Issue
Block a user