diff --git a/CHANGELOG.md b/CHANGELOG.md index 44209b3..b9f3408 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- The chaos monkey's notice in the NOC no longer has an Open button that did nothing; the monkey's own card is right above it (#226). - The puzzle list counts each section's own stars: architect runs show theirs next to their title, and the pack total now sits right above the packs, the stars that unlock the next one (#231). - The intern's notes now name the exchanges it peered at: a city's first exchange showed as the city, so "Apfelwein-IX, London" really meant Apfelwein-IX and LYNX (#228). - Cancelling an IRU, giving up your own fiber or decommissioning a POP now puts the optics on its fibers back on the spares shelf, instead of throwing them away (#229). diff --git a/src/game/95-modals/20-notifications.js b/src/game/95-modals/20-notifications.js index 64b56f1..84447c6 100644 --- a/src/game/95-modals/20-notifications.js +++ b/src/game/95-modals/20-notifications.js @@ -19,11 +19,12 @@ function logNote(html,kind,actions,open){S.log=S.log||[];const tmp=document.crea const logRecent=()=>{const now=Date.now();return (S.log||[]).filter(e=>e.at&&now-e.atlogRecent().filter(e=>e.at>(UI.logSeen||0)).length; const agoStr=at=>{const m=Math.floor((Date.now()-at)/60000);return m<1?tr('common.just_now'):trn('notifications.n_min_ago',m);}; +// The list is the NOC tab: a notice that would open the NOC gets no Open button, since it would do nothing (#226). function logSection(){const L=logRecent(),MAX=5,all=UI.logAll,sh=all?L:L.slice(0,MAX); let h=`

${tr('common.notifications')} ${tr('notifications.last_10_minutes')}

`; if(!L.length)return h+`

${tr('notifications.nothing_in_the_last_10_minutes')}

`; h+=sh.map(e=>{const body=e.h&&e.t.startsWith(e.h)?e.t.slice(e.h.length).trim():e.t; - return `
${e.h?`
${esc(e.h)}${e.n>1?` ×${e.n}`:''}
`:''}${body?`
${esc(body)}${!e.h&&e.n>1?` ×${e.n}`:''}
`:''}
${agoStr(e.at)} · ${dateStr(e.d)}
${e.o?btn(tr('common.open'),'logOpen',{id:e.id},'ghost sm'):''}
`;}).join(''); + return `
${e.h?`
${esc(e.h)}${e.n>1?` ×${e.n}`:''}
`:''}${body?`
${esc(body)}${!e.h&&e.n>1?` ×${e.n}`:''}
`:''}
${agoStr(e.at)} · ${dateStr(e.d)}
${e.o&&!(e.o.a==='tab'&&e.o.v==='noc')?btn(tr('common.open'),'logOpen',{id:e.id},'ghost sm'):''}
`;}).join(''); if(L.length>MAX)h+=`
${btn(all?tr('common.show_fewer'):tr('notifications.show_all_n',{n:L.length}),'logAll',{},'ghost sm')}
`; return h;} const markLayer=()=>{UI.layerAt=performance.now();}; diff --git a/tests/chaos-monkey.test.js b/tests/chaos-monkey.test.js index 4e75a9e..fedcfdd 100644 --- a/tests/chaos-monkey.test.js +++ b/tests/chaos-monkey.test.js @@ -107,3 +107,14 @@ test('"Met the Chaos Monkey" comes from a visit, not from an ordinary fiber cut' assert.equal(ev("BADGES.find(b=>b.id==='backhoe').t"), 'Met the Chaos Monkey'); assert.deepEqual(errors, []); }); + +test('#226 the monkey\'s notice in the NOC has no Open button that would open the NOC again', () => { + const { ev, errors } = net('oncall'); + ev('mkArrive(S.day);ACT.leftTab({t:"noc"})'); + const row = ev(`(()=>{const e=S.log.find(x=>x.o&&x.o.a==='tab'&&x.o.v==='noc');if(!e)return 'none';const r=[...document.querySelectorAll('#left .row.note')].find(n=>n.textContent.includes(e.t.slice(0,20)));return r?(r.querySelector('[data-act=logOpen]')?'button':'no button'):'not shown'})()`); + assert.equal(row, 'no button'); + // a notice that opens something else keeps its button + ev("toast('A test notice','',[],{a:'bank'});ACT.leftTab({t:'noc'})"); + assert.equal(ev(`!![...document.querySelectorAll('#left .row.note')].find(n=>n.textContent.includes('A test notice')).querySelector('[data-act=logOpen]')`), true); + assert.deepEqual(errors, []); +});