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');