Fix "Not Participating" filter checkbox on Discover Challenges screen, Fixes #13025 (#13183)

* change 'role' options and filters to 'membership'

* added membership filtering function to discover challenges

* fix accidental deletion

* complete removal of roles from challenge filters

* abstract challenge "participating" filtering into mixin

* selecting "participating" and "not participating" shows all challenges
This commit is contained in:
Liza
2021-05-28 17:57:03 -04:00
committed by GitHub
parent f097077009
commit 9e655d70d2
4 changed files with 36 additions and 60 deletions

View File

@@ -51,7 +51,7 @@
</div>
<div class="row">
<div
v-if="!loading && challenges.length > 0 && filteredChallenges.length === 0"
v-if="!loading && challenges.length > 0 && this.filteredChallenges.length === 0"
class="no-challenges text-center col-md-6 offset-3"
>
<h2 v-once>
@@ -61,7 +61,7 @@
</div>
<div class="row">
<div
v-for="challenge in filteredChallenges"
v-for="challenge in this.filteredChallenges"
:key="challenge._id"
class="col-12 col-md-6"
>
@@ -197,25 +197,6 @@ export default {
},
computed: {
...mapState({ user: 'user.data' }),
filteredChallenges () {
const { filters } = this;
const { user } = this;
return this.challenges.filter(challenge => {
let isMember = true;
const filteringRole = filters.roles && filters.roles.length > 0;
if (filteringRole && filters.roles.indexOf('participating') !== -1) {
isMember = this.isMemberOfChallenge(user, challenge);
}
if (filteringRole && filters.roles.indexOf('not_participating') !== -1) {
isMember = !this.isMemberOfChallenge(user, challenge);
}
return isMember;
});
},
},
mounted () {
this.$store.dispatch('common:setTitle', {