From 5b67abf34bccee1425b980675865319eb3c7602c Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Mon, 28 Sep 2015 14:58:14 -0700 Subject: [PATCH] Better parsing of the website's title when viewing a channel --- web/react/components/sidebar.jsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx index 14664ed4d5..6033f200f3 100644 --- a/web/react/components/sidebar.jsx +++ b/web/react/components/sidebar.jsx @@ -268,14 +268,19 @@ export default class Sidebar extends React.Component { } } updateTitle() { - var channel = ChannelStore.getCurrent(); + const channel = ChannelStore.getCurrent(); if (channel) { - if (channel.type === 'D') { - var teammateUsername = Utils.getDirectTeammate(channel.id).username; - document.title = teammateUsername + ' ' + document.title.substring(document.title.lastIndexOf('-')); - } else { - document.title = channel.display_name + ' ' + document.title.substring(document.title.lastIndexOf('-')); + let currentSiteName = ''; + if (global.window.config.SiteName != null) { + currentSiteName = global.window.config.SiteName; } + + let currentChannelName = channel.display_name; + if (channel.type === 'D') { + currentChannelName = Utils.getDirectTeammate(channel.id).username; + } + + document.title = currentChannelName + ' - ' + this.props.teamDisplayName + ' ' + currentSiteName; } } onScroll() {