implement more reliable check for whether a channel on the server is new
This commit is contained in:
@@ -277,6 +277,21 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
Store.isNewChannel = function (data, cb) {
|
||||
if (!store.anon_rpc) { return void cb({error: 'ANON_RPC_NOT_READY'}); }
|
||||
var channelId = Hash.hrefToHexChannelId(data.href);
|
||||
store.anon_rpc.send("IS_NEW_CHANNEL", channelId, function (e, response) {
|
||||
if (e) { return void cb({error: e}); }
|
||||
if (response && response.length && typeof(response[0]) === 'boolean') {
|
||||
return void cb({
|
||||
isNew: response[0]
|
||||
});
|
||||
} else {
|
||||
cb({error: 'INVALID_RESPONSE'});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Store.getMultipleFileSize = function (data, cb) {
|
||||
if (!store.anon_rpc) { return void cb({error: 'ANON_RPC_NOT_READY'}); }
|
||||
if (!Array.isArray(data.files)) {
|
||||
|
||||
@@ -160,8 +160,13 @@ define([
|
||||
case 'DRIVE_USEROBJECT': {
|
||||
Store.userObjectCommand(data, cb); break;
|
||||
}
|
||||
|
||||
case 'IS_NEW_CHANNEL': {
|
||||
Store.isNewChannel(data, cb); break;
|
||||
}
|
||||
default: {
|
||||
|
||||
console.error("UNHANDLED_STORE_RPC");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user