mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 03:14:03 +03:00
🐛 Fixed duplicate member columns when filtering
refs https://ghost.slack.com/archives/CTH5NDJMS/p1672999077197199 When filtering on the same filter twice, columns were added twice. This change removes duplicate columns.
This commit is contained in:
parent
26635f192f
commit
21835b0b03
@ -173,12 +173,12 @@ export default class MembersController extends Controller {
|
||||
}
|
||||
|
||||
get filterColumns() {
|
||||
return this.availableFilters.flatMap((filter) => {
|
||||
const columns = this.availableFilters.flatMap((filter) => {
|
||||
if (filter.properties?.getColumns) {
|
||||
return filter.properties?.getColumns(filter).map((c) => {
|
||||
return {
|
||||
label: filter.properties.columnLabel, // default value if not provided
|
||||
...c,
|
||||
...c,
|
||||
name: filter.type
|
||||
};
|
||||
});
|
||||
@ -193,7 +193,12 @@ export default class MembersController extends Controller {
|
||||
];
|
||||
}
|
||||
return [];
|
||||
}).splice(0, 2); // Maximum 2 columns
|
||||
});
|
||||
// Remove duplicates by label
|
||||
const uniqueColumns = columns.filter((c, i) => {
|
||||
return columns.findIndex(c2 => c2.label === c.label) === i;
|
||||
});
|
||||
return uniqueColumns.splice(0, 2); // Maximum 2 columns
|
||||
}
|
||||
|
||||
includeTierQuery() {
|
||||
|
Loading…
Reference in New Issue
Block a user