diff --git a/apps/chat/src/js/components/root.js b/apps/chat/src/js/components/root.js index fa98a0c36..3ea3318dd 100644 --- a/apps/chat/src/js/components/root.js +++ b/apps/chat/src/js/components/root.js @@ -63,9 +63,23 @@ export class Root extends Component { if (messages[cir].length === 0) { unreads[cir] = false; } else { - unreads[cir] = - state.configs[cir].red < - messages[cir][messages[cir].length - 1].num; + let host = `~${window.ship}`; + let circle = cir.split('/')[1]; + let internalStation = host + '/hall-internal-' + circle; + + if (internalStation in state.configs) { + console.log(state.configs[internalStation].red, messages[cir]); + + unreads[cir] = + state.configs[internalStation].red <= + messages[cir][messages[cir].length - 1].num; + } else { + console.log(cir, messages[cir], state.configs[cir].red); + + unreads[cir] = + state.configs[cir].red <= + messages[cir][messages[cir].length - 1].num; + } } } else { unreads[cir] = false; diff --git a/apps/chat/src/js/components/sidebar.js b/apps/chat/src/js/components/sidebar.js index 95d27a842..0fff33f19 100644 --- a/apps/chat/src/js/components/sidebar.js +++ b/apps/chat/src/js/components/sidebar.js @@ -76,13 +76,7 @@ export class Sidebar extends Component { return b.wen - a.wen; }) .map((obj) => { - let host = `~${window.ship}`; - let circle = obj.cir.split('/')[1]; - let unread = props.unreads[obj.cir]; - if (host + '/hall-internal-' + circle in props.unreads) { - unread = props.unreads[host + '/hall-internal-' + circle]; - } return (