@@ -66,6 +66,9 @@ export default defineComponent({
66
66
showDeprecatedMods(): boolean {
67
67
return this .$store .state .search .showDeprecatedMods ;
68
68
},
69
+ showNsfwMods(): boolean {
70
+ return this .$store .state .search .showNsfwMods ;
71
+ },
69
72
searchValue(): string {
70
73
return this .$store .getters .searchWords ;
71
74
},
@@ -95,22 +98,25 @@ export default defineComponent({
95
98
// Filter out deprecated mods
96
99
const showDeprecated = ! mod .is_deprecated || this .showDeprecatedMods ;
97
100
101
+ // Filter out NSFW mods
102
+ const showNsfw = ! mod .has_nsfw_content || this .showNsfwMods ;
103
+
98
104
// Filter with categories (only if some categories are selected)
99
105
const categoriesMatch: boolean = this .selectedCategories .length === 0
100
106
|| mod .categories
101
107
.filter ((category : string ) => this .selectedCategories .includes (category ))
102
108
.length === this .selectedCategories .length ;
103
109
104
- return inputMatches && categoriesMatch && showDeprecated ;
110
+ return inputMatches && categoriesMatch && showDeprecated && showNsfw ;
105
111
});
106
112
},
107
113
modsList(): ThunderstoreMod [] {
108
114
// Use filtered mods if user is searching, vanilla list otherwise.
109
115
const mods: ThunderstoreMod [] = this .searchValue .length !== 0 || this .selectedCategories .length !== 0
110
116
? this .filteredMods
111
- : this .showDeprecatedMods
112
- ? this .mods
113
- : this . mods . filter (mod => ! mod .is_deprecated );
117
+ : this .mods
118
+ . filter ( mod => this .showDeprecatedMods || ! mod . is_deprecated )
119
+ . filter (mod => this . showNsfwMods || ! mod .has_nsfw_content );
114
120
115
121
// Sort mods regarding user selected algorithm.
116
122
let compare: (a : ThunderstoreMod , b : ThunderstoreMod ) => number ;
0 commit comments