allow users to pin the first time, even if they are over their limit
This commit is contained in:
parent
fe42f5e88c
commit
52975a2f09
12
rpc.js
12
rpc.js
@ -220,6 +220,7 @@ var loadUserPins = function (Env, publicKey, cb) {
|
|||||||
var parsed;
|
var parsed;
|
||||||
try {
|
try {
|
||||||
parsed = JSON.parse(msg);
|
parsed = JSON.parse(msg);
|
||||||
|
session.hasPinned = true;
|
||||||
|
|
||||||
switch (parsed[0]) {
|
switch (parsed[0]) {
|
||||||
case 'PIN':
|
case 'PIN':
|
||||||
@ -575,7 +576,16 @@ var resetUserPins = function (Env, publicKey, channelList, cb) {
|
|||||||
console.error(e);
|
console.error(e);
|
||||||
return void cb(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]),
|
pinStore.message(publicKey, JSON.stringify(['RESET', channelList]),
|
||||||
function (e) {
|
function (e) {
|
||||||
if (e) { return void cb(e); }
|
if (e) { return void cb(e); }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user