diff --git a/router.go b/router.go index 52ccf64..e84cc2e 100644 --- a/router.go +++ b/router.go @@ -192,6 +192,8 @@ func (app *appContext) loadRoutes(router *gin.Engine) { api.GET(p+"/telegram/pin", app.TelegramGetPin) api.GET(p+"/telegram/verified/:pin", app.TelegramVerified) api.POST(p+"/users/telegram", app.TelegramAddUser) + } + if emailEnabled { api.POST(p+"/users/contact", app.SetContactMethods) } if discordEnabled { diff --git a/ts/modules/accounts.ts b/ts/modules/accounts.ts index c4ce256..beb3dd5 100644 --- a/ts/modules/accounts.ts +++ b/ts/modules/accounts.ts @@ -74,9 +74,11 @@ class user implements User { const telegram = window.telegramEnabled && this._telegramUsername && this._telegramUsername != ""; const discord = window.discordEnabled && this._discordUsername && this._discordUsername != ""; const matrix = window.matrixEnabled && this._matrixID && this._matrixID != ""; + const email = window.emailEnabled && this.email != ""; if (discord) return "discord"; if (matrix) return "matrix"; if (telegram) return "telegram"; + if (email) return "email"; } get selected(): boolean { return this._selected; } @@ -132,6 +134,15 @@ class user implements User { } else { this._email.textContent = value; } + const lastNotifyMethod = this.lastNotifyMethod() == "email"; + if (!value) { + this._notifyDropdown.querySelector(".accounts-area-email").classList.add("unfocused"); + } else { + this._notifyDropdown.querySelector(".accounts-area-email").classList.remove("unfocused"); + if (lastNotifyMethod) { + (this._email.parentElement as HTMLDivElement).appendChild(this._notifyDropdown); + } + } } get notify_email(): boolean { return this._notifyEmail; } @@ -146,17 +157,20 @@ class user implements User { const telegram = this._telegramUsername != ""; const discord = this._discordUsername != ""; const matrix = this._matrixID != ""; - if (!telegram && !discord && !matrix) return; + const email = this._emailAddress != ""; + if (!telegram && !discord && !matrix && !email) return; let innerHTML = `