From b9a74c2119cfb02a61e0f4f238a0d4ff29a4ef7c Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 3 May 2018 10:18:36 +0200 Subject: [PATCH 1/2] hide visible effects of race condition, leave a note to remember to fix it --- www/file/inner.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/www/file/inner.js b/www/file/inner.js index 8ad9532ad..7a12c22b1 100644 --- a/www/file/inner.js +++ b/www/file/inner.js @@ -124,6 +124,12 @@ define([ var rightsideDisplayed = false; $(window.document).on('decryption', function (e) { + /* FIXME + we're listening for decryption events and assuming that only + the main media-tag exists. In practice there is also your avatar + and there could be other things in the future, so we should + figure out a generic way target media-tag decryption events. + */ var decrypted = e.originalEvent; if (decrypted.callback) { decrypted.callback(); @@ -133,9 +139,6 @@ define([ $dlform.hide(); var $dlButton = $dlview.find('media-tag button'); if (ev) { $dlButton.click(); } - if (!$dlButton.length) { - $appContainer.css('background', 'white'); - } $dlButton.addClass('btn btn-success'); var text = Messages.download_mt_button + '
'; text += '' + Util.fixHTML(title) + '
'; From 381d4ac1917f2ece271e3f4f60dda4ec5805521d Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 3 May 2018 11:08:56 +0200 Subject: [PATCH 2/2] make resets explicit --- pinneddata.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pinneddata.js b/pinneddata.js index f9053b9b6..2921885f0 100644 --- a/pinneddata.js +++ b/pinneddata.js @@ -3,6 +3,11 @@ const Fs = require('fs'); const Semaphore = require('saferphore'); const nThen = require('nthen'); +/* + takes contents of a pinFile (UTF8 string) + and the pin file's name + returns an array of of channel ids which are pinned +*/ const hashesFromPinFile = (pinFile, fileName) => { var pins = {}; pinFile.split('\n').filter((x)=>(x)).map((l) => JSON.parse(l)).forEach((l) => { @@ -10,8 +15,7 @@ const hashesFromPinFile = (pinFile, fileName) => { case 'RESET': { pins = {}; if (l[1] && l[1].length) { l[1].forEach((x) => { pins[x] = 1; }); } - //jshint -W086 - // fallthrough + break; } case 'PIN': { l[1].forEach((x) => { pins[x] = 1; });