Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ scanner candidates. This prevents an error from being thrown in the candidate pa
- Partially fix instrument escaping issues by reloading instrument and its data upon successful save (PR #7776)
- Fix recognition of null sessionID in NDB_BVL_Instrument (PR #8031)
- Fix bug where server_processes_manager had a timeout (PR #8071)
- Candidate profile page loads with only the visits listed that a user has access to
if a candidate has some visits that the user should not see. Fixes error where page was not loading for this use case (PR #8072)


### Modules
Expand Down
16 changes: 13 additions & 3 deletions modules/candidate_profile/templates/form_candidate_profile.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,22 @@ window.addEventListener('load', () => {
let visits = candidate.Visits.map(async function(visit) {
// FIXME: This shouldn't use the dev version. See #6058
let response = await fetch(loris.BaseURL + '/api/v0.0.3/candidates/' + candidate.Meta.CandID + '/' + visit);
let data = await response.json();
return data;
if (!response.ok) {
return new Error('Permission denied');
} else {
let data = await response.json();
return data;
}
});
return Promise.all(visits);
}

async function filterVisits(visits) {
return visits.filter(function(v) {
return !(v instanceof Error);
});
}

async function loadCards(visits) {
// Common properties that all cards get for free
let baseprops = {
Expand Down Expand Up @@ -73,6 +83,6 @@ window.addEventListener('load', () => {
);
}

loadCandidate().then(loadVisits).then(loadCards).then(displayCards);
loadCandidate().then(loadVisits).then(filterVisits).then(loadCards).then(displayCards);
});
</script>