Skip to content

Commit c70ff23

Browse files
committed
filter out blocked recommendations
1 parent 4b54372 commit c70ff23

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

frontend/src/components/app/recommendations/Recommendations.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@ export default {
147147
}
148148
return true;
149149
},
150+
filterOutBlockedUsers(recommendations) {
151+
let i = recommendations.length;
152+
const { blocks } = this.$store.getters.getLoggedInUser;
153+
let blockedIds = [];
154+
for (let j = 0; j < blocks.length; j += 1) {
155+
blockedIds.push(blocks[j].blocked_id);
156+
}
157+
while (i--) {
158+
if (blockedIds.indexOf(recommendations[i].id) !== -1) {
159+
recommendations.splice(i, 1);
160+
}
161+
}
162+
return recommendations;
163+
},
150164
},
151165
watch: {
152166
sorting: {
@@ -165,8 +179,8 @@ export default {
165179
}
166180
},
167181
beforeMount() {
168-
this.recommendations = this.recommendationsReceived;
169-
this.recommendationsBackup = this.recommendationsReceived;
182+
this.recommendations = this.filterOutBlockedUsers(this.recommendationsReceived);
183+
this.recommendationsBackup = this.recommendations;
170184
this.filters.age.min = this.recommendationsAnalysis.age.min;
171185
this.filters.age.max = this.recommendationsAnalysis.age.max;
172186
this.filters.distance.min = this.recommendationsAnalysis.distance.min;

0 commit comments

Comments
 (0)