Always show multi-server header when using multiple servers

Previously, if the user was on only one server, the server name would not be shown in the thread header.
master
Miikka 2018-05-03 19:37:50 +03:00 committed by GitHub
parent 777ea2dd2c
commit 685ccdd226
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -115,8 +115,9 @@ async function createNewThreadForUser(user, quiet = false) {
// Guild info // Guild info
const guildInfoHeaderItems = new Map(); const guildInfoHeaderItems = new Map();
const mainGuilds = utils.getMainGuilds();
utils.getMainGuilds().forEach(guild => { mainGuilds.forEach(guild => {
const member = guild.members.get(user.id); const member = guild.members.get(user.id);
if (! member) return; if (! member) return;
@ -128,7 +129,7 @@ async function createNewThreadForUser(user, quiet = false) {
}); });
guildInfoHeaderItems.forEach((items, guildName) => { guildInfoHeaderItems.forEach((items, guildName) => {
if (guildInfoHeaderItems.size === 1) { if (mainGuilds.length === 1) {
infoHeader += `\n${items.join(', ')}`; infoHeader += `\n${items.join(', ')}`;
} else { } else {
infoHeader += `\n**[${guildName}]** ${items.join(', ')}`; infoHeader += `\n**[${guildName}]** ${items.join(', ')}`;