mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
accounts: Show "contact through" cog when only email is given"
one portion of #233: When adding an email address to an account, the admin (for now) will manually have to enable its use by clicking the cog icon and enabling "contact through email". Only for now, currently some other unfinished work is stopping me from committing the other portion of code for this issue.
This commit is contained in:
parent
47d00d1f27
commit
ac25c9cd7f
@ -192,6 +192,8 @@ func (app *appContext) loadRoutes(router *gin.Engine) {
|
|||||||
api.GET(p+"/telegram/pin", app.TelegramGetPin)
|
api.GET(p+"/telegram/pin", app.TelegramGetPin)
|
||||||
api.GET(p+"/telegram/verified/:pin", app.TelegramVerified)
|
api.GET(p+"/telegram/verified/:pin", app.TelegramVerified)
|
||||||
api.POST(p+"/users/telegram", app.TelegramAddUser)
|
api.POST(p+"/users/telegram", app.TelegramAddUser)
|
||||||
|
}
|
||||||
|
if emailEnabled {
|
||||||
api.POST(p+"/users/contact", app.SetContactMethods)
|
api.POST(p+"/users/contact", app.SetContactMethods)
|
||||||
}
|
}
|
||||||
if discordEnabled {
|
if discordEnabled {
|
||||||
|
@ -74,9 +74,11 @@ class user implements User {
|
|||||||
const telegram = window.telegramEnabled && this._telegramUsername && this._telegramUsername != "";
|
const telegram = window.telegramEnabled && this._telegramUsername && this._telegramUsername != "";
|
||||||
const discord = window.discordEnabled && this._discordUsername && this._discordUsername != "";
|
const discord = window.discordEnabled && this._discordUsername && this._discordUsername != "";
|
||||||
const matrix = window.matrixEnabled && this._matrixID && this._matrixID != "";
|
const matrix = window.matrixEnabled && this._matrixID && this._matrixID != "";
|
||||||
|
const email = window.emailEnabled && this.email != "";
|
||||||
if (discord) return "discord";
|
if (discord) return "discord";
|
||||||
if (matrix) return "matrix";
|
if (matrix) return "matrix";
|
||||||
if (telegram) return "telegram";
|
if (telegram) return "telegram";
|
||||||
|
if (email) return "email";
|
||||||
}
|
}
|
||||||
|
|
||||||
get selected(): boolean { return this._selected; }
|
get selected(): boolean { return this._selected; }
|
||||||
@ -132,6 +134,15 @@ class user implements User {
|
|||||||
} else {
|
} else {
|
||||||
this._email.textContent = value;
|
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; }
|
get notify_email(): boolean { return this._notifyEmail; }
|
||||||
@ -146,17 +157,20 @@ class user implements User {
|
|||||||
const telegram = this._telegramUsername != "";
|
const telegram = this._telegramUsername != "";
|
||||||
const discord = this._discordUsername != "";
|
const discord = this._discordUsername != "";
|
||||||
const matrix = this._matrixID != "";
|
const matrix = this._matrixID != "";
|
||||||
if (!telegram && !discord && !matrix) return;
|
const email = this._emailAddress != "";
|
||||||
|
if (!telegram && !discord && !matrix && !email) return;
|
||||||
let innerHTML = `
|
let innerHTML = `
|
||||||
<i class="icon ri-settings-2-line ml-2 dropdown-button"></i>
|
<i class="icon ri-settings-2-line ml-2 dropdown-button"></i>
|
||||||
<div class="dropdown manual">
|
<div class="dropdown manual">
|
||||||
<div class="dropdown-display lg">
|
<div class="dropdown-display lg">
|
||||||
<div class="card ~neutral @low">
|
<div class="card ~neutral @low">
|
||||||
<span class="supra sm">${window.lang.strings("contactThrough")}</span>
|
<span class="supra sm">${window.lang.strings("contactThrough")}</span>
|
||||||
<label class="row switch pb-4 mt-2">
|
<div class="accounts-area-email">
|
||||||
<input type="checkbox" name="accounts-contact-${this.id}" class="accounts-contact-email mr-2">
|
<label class="row switch pb-4 mt-2">
|
||||||
</span>Email</span>
|
<input type="checkbox" name="accounts-contact-${this.id}" class="accounts-contact-email mr-2">
|
||||||
</label>
|
</span>Email</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="accounts-area-telegram">
|
<div class="accounts-area-telegram">
|
||||||
<label class="row switch pb-4">
|
<label class="row switch pb-4">
|
||||||
<input type="checkbox" name="accounts-contact-${this.id}" class="accounts-contact-telegram mr-2">
|
<input type="checkbox" name="accounts-contact-${this.id}" class="accounts-contact-telegram mr-2">
|
||||||
@ -857,7 +871,7 @@ export class accountsList {
|
|||||||
this._disableEnable.classList.add("unfocused");
|
this._disableEnable.classList.add("unfocused");
|
||||||
}
|
}
|
||||||
if (!showDisableEnable && anyNonExpiries) { break; }
|
if (!showDisableEnable && anyNonExpiries) { break; }
|
||||||
if (!this._users[id].lastNotifyMethod() && !this._users[id].email) {
|
if (!this._users[id].lastNotifyMethod()) {
|
||||||
noContactCount++;
|
noContactCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user