My Challenges should include all Owned Challenges (#9286)

This commit is contained in:
Marvin Rabe
2018-05-07 16:23:49 +02:00
parent 0d84643961
commit 5f319ca4f6

View File

@@ -63,8 +63,6 @@
</style> </style>
<script> <script>
import { mapState } from 'client/libs/store';
import Sidebar from './sidebar'; import Sidebar from './sidebar';
import ChallengeItem from './challengeItem'; import ChallengeItem from './challengeItem';
import challengeModal from './challengeModal'; import challengeModal from './challengeModal';
@@ -111,24 +109,18 @@ export default {
}, },
], ],
search: '', search: '',
filters: { filters: {},
roles: ['participating'], // This is required for my challenges
},
}; };
}, },
mounted () { mounted () {
this.loadchallanges(); this.loadchallanges();
}, },
computed: { computed: {
...mapState({user: 'user.data'}),
filteredChallenges () { filteredChallenges () {
let search = this.search; let search = this.search;
let filters = this.filters; let filters = this.filters;
let user = this.$store.state.user.data; let user = this.$store.state.user.data;
// Always filter by member on this page:
filters.roles = ['participating'];
// @TODO: Move this to the server // @TODO: Move this to the server
return this.challenges.filter((challenge) => { return this.challenges.filter((challenge) => {
return this.filterChallenge(challenge, filters, search, user); return this.filterChallenge(challenge, filters, search, user);
@@ -136,9 +128,6 @@ export default {
}, },
}, },
methods: { methods: {
memberOf (challenge) {
return this.user.challenges.indexOf(challenge._id) !== -1;
},
updateSearch (eventData) { updateSearch (eventData) {
this.search = eventData.searchTerm; this.search = eventData.searchTerm;
}, },