From 8574c53bf858d6a31b4accc75fa7417530248950 Mon Sep 17 00:00:00 2001 From: Mentor Palokaj Date: Wed, 17 Nov 2021 13:40:40 +0100 Subject: [PATCH] Actually delete --- functions/integrations/avatar.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/functions/integrations/avatar.js b/functions/integrations/avatar.js index adf7750..233b860 100644 --- a/functions/integrations/avatar.js +++ b/functions/integrations/avatar.js @@ -89,7 +89,7 @@ exports.setAvatar = async function( req, res ) { exports.resetAvatar = async function( req, res ) { - const chain = process.env.NODE_ENV == 'development' ? '0x4' : '0x1' + // const chain = process.env.NODE_ENV == 'development' ? '0x4' : '0x1' const network = 'mainnet' // const chain = '0x1' @@ -117,6 +117,12 @@ exports.resetAvatar = async function( req, res ) { } const cachedJson = JSON.parse( jsonstring ) + // Delete the address + if( jsonstring.images[ address ] ) { + delete jsonstring.images[ address ] + delete jsonstring.ids[ address ] + } + // Get items that have not been updated const tenSecondsAgo = Date.now() - ( 10 * 1000 ) const shouldBeUpdated = await db.collection( `${ network }Validators` ).where( 'updated', '>', cachedJson.updated || tenSecondsAgo ).get().then( dataFromSnap )