1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 17:10:10 +00:00

accounts: show "Set expiry" button for non-disabled users

previously hidden in a dropdown on the "re-enable" button for disabled
users only, now can be used on active ones.
This commit is contained in:
Harvey Tindall 2022-01-25 15:27:16 +00:00
parent 8fd097836f
commit 987e0ddd4e
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
2 changed files with 22 additions and 1 deletions

View File

@ -205,6 +205,10 @@
"singular": "Extend expiry for {n} user",
"plural": "Extend expiry for {n} users"
},
"setExpiry": {
"singular": "Set expiry for {n} user",
"plural": "Set expiry for {n} users"
},
"extendedExpiry": {
"singular": "Extended expiry for {n} user.",
"plural": "Extended expiry for {n} users."

View File

@ -699,6 +699,9 @@ export class accountsList {
private _addUserEmail = this._addUserForm.querySelector("input[type=email]") as HTMLInputElement;
private _addUserPassword = this._addUserForm.querySelector("input[type=password]") as HTMLInputElement;
// Whether the "Extend expiry" is extending or setting an expiry.
private _settingExpiry = false;
private _count = 30;
private _populateNumbers = () => {
const fieldIDs = ["months", "days", "hours", "minutes"];
@ -836,6 +839,7 @@ export class accountsList {
this._announceButton.classList.remove("unfocused");
}
let anyNonExpiries = list.length == 0 ? true : false;
let allNonExpiries = true;
let noContactCount = 0;
// Only show enable/disable button if all selected have the same state.
this._shouldEnable = this._users[list[0]].disabled
@ -845,6 +849,9 @@ export class accountsList {
anyNonExpiries = true;
this._extendExpiry.classList.add("unfocused");
}
if (this._users[id].expiry) {
allNonExpiries = false;
}
if (showDisableEnable && this._users[id].disabled != this._shouldEnable) {
showDisableEnable = false;
this._disableEnable.classList.add("unfocused");
@ -854,8 +861,15 @@ export class accountsList {
noContactCount++;
}
}
if (!anyNonExpiries) {
this._settingExpiry = false;
if (!anyNonExpiries && !allNonExpiries) {
this._extendExpiry.classList.remove("unfocused");
this._extendExpiry.textContent = window.lang.strings("extendExpiry");
}
if (allNonExpiries) {
this._extendExpiry.classList.remove("unfocused");
this._extendExpiry.textContent = window.lang.strings("setExpiry");
this._settingExpiry = true;
}
// Only show "Send PWR" if a maximum of 1 user selected doesn't have a contact method
if (noContactCount > 1) {
@ -1317,6 +1331,9 @@ export class accountsList {
this._enableExpiryNotify.parentElement.classList.remove("unfocused");
this._enableExpiryNotify.checked = false;
this._enableExpiryReason.value = "";
} else if (this._settingExpiry) {
header = window.lang.quantity("setExpiry", list.length);
this._enableExpiryNotify.parentElement.classList.add("unfocused");
} else {
header = window.lang.quantity("extendExpiry", applyList.length);
this._enableExpiryNotify.parentElement.classList.add("unfocused");