From ca04d5bcbb92a6ddc075ee0cfd94bc450fc47e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20=C3=96hlerking?= Date: Thu, 10 Oct 2024 11:59:27 +0200 Subject: [PATCH] fix outdated users for team invites --- controllers/users.js | 3 +++ static/scripts/teamMembers.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/controllers/users.js b/controllers/users.js index 7976cd39cb..aeed9aae8f 100644 --- a/controllers/users.js +++ b/controllers/users.js @@ -47,11 +47,14 @@ router.get('/teachersWithEmail', async (req, res, next) => { }, }); + users.data = users.data.filter((user) => !isUserHidden(user, res.locals.currentSchoolData)); + const result = users.data.map((user) => ({ _id: user._id, firstName: user.firstName, lastName: user.lastName, schoolName: user.schoolId.name, + outdatedSince: user.outdatedSince, })); return res.json(result); diff --git a/static/scripts/teamMembers.js b/static/scripts/teamMembers.js index 4856f7a2e5..1d483427ad 100644 --- a/static/scripts/teamMembers.js +++ b/static/scripts/teamMembers.js @@ -224,7 +224,7 @@ $(document).ready(() => { }, }).done((users) => { users.forEach((user) => { - const fullName = `${user.firstName} ${user.lastName} ${user.outdatedSince ? ' ~~' : ''}`; + const fullName = `${user.firstName} ${user.lastName}${user.outdatedSince ? ' ~~' : ''}`; teacherSelect.append(``); }); teacherSelect.trigger('chosen:updated'); @@ -307,7 +307,7 @@ $(document).ready(() => { teacherSelect.find('option').remove(); users.forEach((user) => { - const displayText = `${user.firstName} ${user.lastName} - ${user.schoolName}`; + const displayText = `${user.firstName} ${user.lastName}${user.outdatedSince ? ' ~~' : ''} - ${user.schoolName}`; teacherSelect.append(``); }); teacherSelect.trigger('chosen:updated');