From 52975a2f09d73f44754bb5cb233723532c0cac3c Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 8 Jun 2017 15:26:51 +0200 Subject: [PATCH] allow users to pin the first time, even if they are over their limit --- rpc.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rpc.js b/rpc.js index 1ba8bb80b..6585a88f9 100644 --- a/rpc.js +++ b/rpc.js @@ -220,6 +220,7 @@ var loadUserPins = function (Env, publicKey, cb) { var parsed; try { parsed = JSON.parse(msg); + session.hasPinned = true; switch (parsed[0]) { case 'PIN': @@ -575,7 +576,16 @@ var resetUserPins = function (Env, publicKey, channelList, cb) { console.error(e); return void cb(e); } - if (pinSize > free) { return void(cb('E_OVER_LIMIT')); } + + /* we want to let people pin, even if they are over their limit, + but they should only be able to do this once. + + This prevents data loss in the case that someone registers, but + does not have enough free space to pin their migrated data. + + They will not be able to pin additional pads until they upgrade + or delete enough files to go back under their limit. */ + if (pinSize > free && session.hasPinned) { return void(cb('E_OVER_LIMIT')); } pinStore.message(publicKey, JSON.stringify(['RESET', channelList]), function (e) { if (e) { return void cb(e); }