display channel name in title
This commit is contained in:
parent
28ed386228
commit
52cc76f676
1 changed files with 11 additions and 4 deletions
|
@ -606,13 +606,20 @@ selectedChannel.watch((newSelectedChannel) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
unreadStore.subscribe(() => {
|
|
||||||
|
const updateTitle = () => {
|
||||||
let totalUnreads = 0;
|
let totalUnreads = 0;
|
||||||
unreadStore.value.forEach(count => totalUnreads += count);
|
unreadStore.value.forEach(count => totalUnreads += count);
|
||||||
|
let channelSuffix = "";
|
||||||
|
if (selectedChannel.value && selectedChannel.value.id !== -1 && selectedChannel.value.name) {
|
||||||
|
channelSuffix = ` | #${selectedChannel.value.name}`;
|
||||||
|
}
|
||||||
|
|
||||||
if (totalUnreads > 0) {
|
if (totalUnreads > 0) {
|
||||||
window.document.title = `(${totalUnreads}) waffle`;
|
window.document.title = `(${totalUnreads}) waffle${channelSuffix}`;
|
||||||
} else {
|
} else {
|
||||||
window.document.title = "waffle";
|
window.document.title = `waffle${channelSuffix}`;
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
unreadStore.subscribe(updateTitle);
|
||||||
|
selectedChannel.subscribe(updateTitle);
|
||||||
|
|
Loading…
Reference in a new issue