diff --git a/main.go b/main.go
index b2b99cc..029595d 100644
--- a/main.go
+++ b/main.go
@@ -570,6 +570,7 @@ func start(asDaemon, firstCall bool) {
app.telegram, err = newTelegramDaemon(app)
if err != nil {
app.err.Printf("Failed to authenticate with Telegram: %v", err)
+ telegramEnabled = false
} else {
go app.telegram.run()
defer app.telegram.Shutdown()
@@ -579,6 +580,7 @@ func start(asDaemon, firstCall bool) {
app.discord, err = newDiscordDaemon(app)
if err != nil {
app.err.Printf("Failed to authenticate with Discord: %v", err)
+ discordEnabled = false
} else {
go app.discord.run()
defer app.discord.Shutdown()
diff --git a/telegram.go b/telegram.go
index 00d5ee3..43f6c5d 100644
--- a/telegram.go
+++ b/telegram.go
@@ -83,6 +83,7 @@ func (t *TelegramDaemon) run() {
updates, err := t.bot.GetUpdatesChan(u)
if err != nil {
t.app.err.Printf("Failed to start Telegram daemon: %v", err)
+ telegramEnabled = false
return
}
for {
diff --git a/ts/modules/accounts.ts b/ts/modules/accounts.ts
index a0ae57a..b00ef97 100644
--- a/ts/modules/accounts.ts
+++ b/ts/modules/accounts.ts
@@ -103,7 +103,7 @@ class user implements User {
email.checked = s;
}
}
- if (window.discordEnabled && this._discordUsername != "") {
+ if (window.discordEnabled && this._discordUsername) {
const email = this._discord.getElementsByClassName("accounts-contact-email")[0] as HTMLInputElement;
email.checked = s;
}
@@ -118,11 +118,11 @@ class user implements User {
(this._telegram.querySelector("span") as HTMLSpanElement).onclick = this._addTelegram;
} else {
let innerHTML = `
- @${u}
+
+
@${u}
`;
- if (!window.discordEnabled || this._discordUsername == "") {
+ if (!window.discordEnabled || !this._discordUsername) {
innerHTML += `
-
@@ -139,11 +139,11 @@ class user implements User {
-
`;
}
+ innerHTML += "";
this._telegram.innerHTML = innerHTML;
- if (!window.discordEnabled || this._discordUsername == "") {
+ if (!window.discordEnabled || !this._discordUsername) {
// Javascript is necessary as including the button inside the dropdown would make it too wide to display next to the username.
const button = this._telegram.querySelector("i");
const dropdown = this._telegram.querySelector("div.dropdown") as HTMLDivElement;
@@ -174,7 +174,7 @@ class user implements User {
if (telegram) {
telegram.checked = s;
}
- if (window.discordEnabled && this._discordUsername != "") {
+ if (window.discordEnabled && this._discordUsername) {
const telegram = this._discord.getElementsByClassName("accounts-contact-telegram")[0] as HTMLInputElement;
telegram.checked = s;
}
@@ -189,11 +189,11 @@ class user implements User {
id: this.id,
email: email.checked
}
- if (window.telegramEnabled && this._telegramUsername != "") {
+ if (window.telegramEnabled && this._telegramUsername) {
const telegram = el.getElementsByClassName("accounts-contact-telegram")[0] as HTMLInputElement;
send["telegram"] = telegram.checked;
}
- if (window.discordEnabled && this._discordUsername != "") {
+ if (window.discordEnabled && this._discordUsername) {
const discord = el.getElementsByClassName("accounts-contact-discord")[0] as HTMLInputElement;
send["discord"] = discord.checked;
}
@@ -458,14 +458,14 @@ class user implements User {
this.id = user.id;
this.name = user.name;
this.email = user.email || "";
- this.telegram = user.telegram;
this.discord = user.discord;
+ this.telegram = user.telegram;
this.last_active = user.last_active;
this.admin = user.admin;
this.disabled = user.disabled;
this.expiry = user.expiry;
- this.notify_telegram = user.notify_telegram;
this.notify_discord = user.notify_discord;
+ this.notify_telegram = user.notify_telegram;
this.notify_email = user.notify_email;
this.discord_id = user.discord_id;
}