fix error in pin reset

This commit is contained in:
ansuz
2017-07-04 17:02:29 +02:00
parent 2acbb37291
commit 9bf9130b9d

7
rpc.js
View File

@@ -583,9 +583,10 @@ var resetUserPins = function (Env, publicKey, channelList, cb) {
if (e) { return void cb(e); } if (e) { return void cb(e); }
var pinSize = sumChannelSizes(sizes); var pinSize = sumChannelSizes(sizes);
getFreeSpace(Env, publicKey, function (e, free) {
getLimit(Env, publicKey, function (e, limit) {
if (e) { if (e) {
WARN('getFreeSpace', e); WARN('[RESET_ERR]', e);
return void cb(e); return void cb(e);
} }
@@ -597,7 +598,7 @@ var resetUserPins = function (Env, publicKey, channelList, cb) {
They will not be able to pin additional pads until they upgrade They will not be able to pin additional pads until they upgrade
or delete enough files to go back under their limit. */ or delete enough files to go back under their limit. */
if (pinSize > free && session.hasPinned) { return void(cb('E_OVER_LIMIT')); } if (pinSize > limit && session.hasPinned) { return void(cb('E_OVER_LIMIT')); }
pinStore.message(publicKey, JSON.stringify(['RESET', channelList]), pinStore.message(publicKey, JSON.stringify(['RESET', channelList]),
function (e) { function (e) {
if (e) { return void cb(e); } if (e) { return void cb(e); }