diff --git a/components/app.js b/components/app.js index 488500e..21cd8e6 100644 --- a/components/app.js +++ b/components/app.js @@ -556,11 +556,7 @@ export default class App extends Component { this.whoChannelBuffer(buf.name, buf.server); } - if (buf.type !== BufferType.SERVER) { - document.title = buf.name + ' · ' + this.baseTitle; - } else { - document.title = this.baseTitle; - } + this.updateDocumentTitle(); }); // TODO: only mark as read if user scrolled at the bottom @@ -610,6 +606,15 @@ export default class App extends Component { }); } + updateDocumentTitle() { + let buf = State.getBuffer(this.state, this.state.activeBuffer); + if (buf && buf.type !== BufferType.SERVER) { + document.title = buf.name + ' · ' + this.baseTitle; + } else { + document.title = this.baseTitle; + } + } + prepareChatMessage(serverID, msg) { // Treat server-wide broadcasts as highlights. They're sent by server // operators and can contain important information.