diff --git a/src/shared/components/challenge-listing/Listing/Bucket/index.jsx b/src/shared/components/challenge-listing/Listing/Bucket/index.jsx index 5c1fd0735..22a21d39b 100644 --- a/src/shared/components/challenge-listing/Listing/Bucket/index.jsx +++ b/src/shared/components/challenge-listing/Listing/Bucket/index.jsx @@ -49,6 +49,7 @@ export default function Bucket({ setSort, sort, userId, + auth, expandedTags, expandTag, activeBucket, @@ -65,6 +66,8 @@ export default function Bucket({ }; const activeSort = sort || 'startDate'; + const roles = _.get(auth, 'user.roles'); + // const sortedChallenges = activeBucket === 'all' ? // _.clone(challenges.slice(0, 10)) : _.clone(challenges); let sortedChallenges; @@ -79,17 +82,19 @@ export default function Bucket({ } let filteredChallenges = sortedChallenges; - filteredChallenges = sortedChallenges.filter((ch) => { - if (ch.type === 'Task' - && ch.task - && ch.task.isTask - && ch.task.isAssigned - && Number(ch.task.memberId) !== Number(userId)) { - return null; - } - return ch; - }); + if (!_.includes(roles, 'administrator')) { + filteredChallenges = sortedChallenges.filter((ch) => { + if (ch.type === 'Task' + && ch.task + && ch.task.isTask + && ch.task.isAssigned + && Number(ch.task.memberId) !== Number(userId)) { + return null; + } + return ch; + }); + } // sortedChallenges.sort(Sort[activeSort].func); // const bucketQuery = qs.stringify({ @@ -276,6 +281,7 @@ Bucket.defaultProps = { openChallengesInNewTabs: false, sort: null, userId: '', + auth: {}, expandedTags: [], expandTag: null, activeBucket: '', @@ -306,6 +312,7 @@ Bucket.propTypes = { setSort: PT.func.isRequired, sort: PT.string, userId: PT.number, + auth: PT.shape(), expandedTags: PT.arrayOf(PT.number), expandTag: PT.func, activeBucket: PT.string, diff --git a/src/shared/components/challenge-listing/Listing/index.jsx b/src/shared/components/challenge-listing/Listing/index.jsx index 6392d2db5..badc68173 100644 --- a/src/shared/components/challenge-listing/Listing/index.jsx +++ b/src/shared/components/challenge-listing/Listing/index.jsx @@ -197,6 +197,7 @@ function Listing({ setSort={sort => setSort(bucket, sort)} sort={sorts[bucket]} userId={_.get(auth, 'user.userId')} + auth={auth} activeBucket={activeBucket} // searchTimestamp={searchTimestamp} isLoggedIn={isLoggedIn}