Use exact Users.name for current task lookup and auto-load tasks

This commit is contained in:
2026-03-29 03:00:32 +00:00
parent 6abaf6c778
commit 49824ea3c6
2 changed files with 55 additions and 10 deletions
+28 -5
View File
@@ -317,12 +317,15 @@
usersCache = Array.isArray(data.users) ? data.users : [];
const meId = String(data?.me?.id || '').trim();
const meName = data?.me?.name || data?.me?.email || 'Me';
const meLookupName = String(data?.me?.name || data?.me?.email || '').trim();
const meLookupName = String(data?.me?.lookupName || data?.me?.name || '').trim();
taskUserSelect.innerHTML = '';
for (const user of usersCache) {
const opt = document.createElement('option');
const lookupName = String(user.name || user.email || user.id || '').trim();
const lookupName = String(user.lookupName || user.name || '').trim();
if (!lookupName) {
continue;
}
opt.value = lookupName;
opt.dataset.userId = user.id;
opt.textContent = `${user.name || user.email || user.id}${user.id === meId ? ' (Me)' : ''}`;
@@ -394,6 +397,28 @@
});
}
async function bootstrapTasksPage() {
try {
const client = await ensurePocketBaseClient();
const config = await getPocketBaseConfig();
if (client.authStore?.token) {
try {
await client.collection(config.collection).authRefresh();
} catch {
}
}
await updatePbStatus();
if (client.authStore?.isValid) {
await loadUsers();
await loadTasks();
}
} catch (error) {
writeOutput({ error: error?.message || String(error) });
}
}
function bind(id, handler) {
document.getElementById(id).addEventListener('click', async () => {
try {
@@ -417,9 +442,7 @@
}
});
ensurePocketBaseClient()
.then(() => updatePbStatus())
.catch((error) => writeOutput({ error: error?.message || String(error) }));
bootstrapTasksPage();
loadHealth();
</script>
</body>