mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
My Challenges should include all Owned Challenges (#9286)
This commit is contained in:
@@ -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;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user