Skip to content

Commit 365a715

Browse files
committed
Exclude certain profile images
This change allows us to add a list of avatars to exclude from being shown on the homepage, where they may be liable to cause offense, or be considered inappropriate. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent a142004 commit 365a715

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

generate-stats.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,22 @@ function generateTemplate(data) {
6969
USE generate-stats.js for adjustments.
7070
------------------------*/
7171
var contributors = ${JSON.stringify(Object.entries(data))};
72+
73+
// Certain users may have inappropriate or offense imagery for their profile picture
74+
var exclude = ["mjallday"]
75+
7276
var userRows;
7377
var rows = [14, 14, 14, 14]; // users/row;
7478
var maxRowSize = rows.slice().sort().reverse()[0];
7579
7680
var rowsString = '';
7781
82+
function filter(array) {
83+
return array.filter(function(value, index, arr){
84+
return !exclude.includes(value);
85+
});
86+
}
87+
7888
function shuffle(array) {
7989
for (let i = array.length - 1; i > 0; i--) {
8090
let j = Math.floor(Math.random() * (i + 1));
@@ -91,7 +101,7 @@ function generateTemplate(data) {
91101
return figure;
92102
}
93103
94-
shuffle(contributors);
104+
shuffle(filter(contributors));
95105
96106
function buildRows(rowSet) {
97107
rows.forEach(r => {

tester.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var exclude = ["mjallday"]
2+
3+
4+
function filter(array) {
5+
return array.filter(function(value, index, arr){
6+
return !exclude.includes(value);
7+
});
8+
}
9+
10+
console.log(filter(["alexellis", "mjallday"]))

0 commit comments

Comments
 (0)