Skip to content

Commit

Permalink
chore: revert - no improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Benmuiruri committed Apr 12, 2024
1 parent f30fa84 commit f3ed747
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions shared-libs/search/src/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,12 @@ module.exports = function(Promise, DB) {
return map;
});

const firstMapKeys = Object.keys(responsesMapById[0]);
let intersectionSet = new Set(firstMapKeys);

// NOSONAR_BEGIN
responsesMapById.slice(1).forEach(map => {
intersectionSet = new Set(
[...intersectionSet].filter(id => Object.hasOwnProperty.call(map, id))
);
});
// NOSONAR_END
const intersection = _.intersection(...responsesMapById.map(Object.keys));

// we use the last query response values for sorting by default, but we allow other responses to "pitch in"
// used for displaying muted contacts to the bottom when sorting by last visited date
const lastResponse = responsesMapById.pop();
const result = [...intersectionSet].map(id => {
const result = intersection.map(id => {
const row = lastResponse[id];
responsesMapById.forEach(idMap => {
if (idMap[id].sort) {
Expand Down

0 comments on commit f3ed747

Please sign in to comment.