diff --git a/controllers/users.js b/controllers/users.js
index 07807d8f57..aeed9aae8f 100644
--- a/controllers/users.js
+++ b/controllers/users.js
@@ -3,6 +3,7 @@ const express = require('express');
const router = express.Router();
const api = require('../api');
const { setCookie } = require('../helpers/cookieHelper');
+const { isUserHidden } = require('../helpers/users');
// users
@@ -16,12 +17,15 @@ router.get('/teachersOfSchool', 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,
schoolId: user.schoolId,
email: user.email,
+ outdatedSince: user.outdatedSince,
}));
return res.json(result);
@@ -43,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 38d233ff54..1d483427ad 100644
--- a/static/scripts/teamMembers.js
+++ b/static/scripts/teamMembers.js
@@ -224,7 +224,8 @@ $(document).ready(() => {
},
}).done((users) => {
users.forEach((user) => {
- teacherSelect.append(``);
+ const fullName = `${user.firstName} ${user.lastName}${user.outdatedSince ? ' ~~' : ''}`;
+ teacherSelect.append(``);
});
teacherSelect.trigger('chosen:updated');
}).fail(() => {
@@ -306,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');