profiles: fix application

moving to a DB meant empty slices in the Configuration & Policy structs
were being stored as null, and striking a nerve with Jellyfin.
Mediabrowser library change fixed that by de-nulling them itself, and a
new bool field called "Homescreen" is now used to decide if a profile
has a homescreen layout stored or not. This field is hopefully correctly
filled in during migration.
This commit is contained in:
Harvey Tindall
2023-06-26 13:01:17 +01:00
parent d2253ff069
commit b17d8424e9
10 changed files with 57 additions and 26 deletions
+16 -2
View File
@@ -765,6 +765,7 @@ export class accountsList {
private _addUserName = this._addUserForm.querySelector("input[type=text]") as HTMLInputElement;
private _addUserEmail = this._addUserForm.querySelector("input[type=email]") as HTMLInputElement;
private _addUserPassword = this._addUserForm.querySelector("input[type=password]") as HTMLInputElement;
private _addUserProfile = this._addUserForm.querySelector("select") as HTMLSelectElement;
// Columns for sorting.
private _columns: { [className: string]: Column } = {};
@@ -1252,7 +1253,8 @@ export class accountsList {
const send = {
"username": this._addUserName.value,
"email": this._addUserEmail.value,
"password": this._addUserPassword.value
"password": this._addUserPassword.value,
"profile": this._addUserProfile.value,
};
for (let field in send) {
if (!send[field]) {
@@ -1733,6 +1735,15 @@ export class accountsList {
}
}
private _populateAddUserProfiles = () => {
this._addUserProfile.textContent = "";
let innerHTML = `<option value="none">${window.lang.strings("inviteNoProfile")}</option>`;
for (let i = 0; i < window.availableProfiles.length; i++) {
innerHTML += `<option value="${window.availableProfiles[i]}" ${i == 0 ? "selected" : ""}>${window.availableProfiles[i]}</option>`;
}
this._addUserProfile.innerHTML = innerHTML;
}
constructor() {
this._populateNumbers();
this._users = {};
@@ -1743,7 +1754,10 @@ export class accountsList {
document.addEventListener("accounts-reload", this.reload);
document.addEventListener("accountCheckEvent", () => { this._checkCount++; this._checkCheckCount(); });
document.addEventListener("accountUncheckEvent", () => { this._checkCount--; this._checkCheckCount(); });
this._addUserButton.onclick = window.modals.addUser.toggle;
this._addUserButton.onclick = () => {
this._populateAddUserProfiles();
window.modals.addUser.toggle();
};
this._addUserForm.addEventListener("submit", this._addUser);
this._deleteNotify.onchange = () => {