Skip to content

Commit

Permalink
fix outdated users for team invites
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinOehlerkingCap committed Oct 10, 2024
1 parent 68ef3f6 commit ca04d5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions controllers/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions static/scripts/teamMembers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(`<option value="${user._id}">${fullName}</option>`);
});
teacherSelect.trigger('chosen:updated');
Expand Down Expand Up @@ -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(`<option value="${user._id}">${displayText}</option>`);
});
teacherSelect.trigger('chosen:updated');
Expand Down

0 comments on commit ca04d5b

Please sign in to comment.