Use exact Users.name for current task lookup and auto-load tasks
This commit is contained in:
+28
-5
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user