Skip to content

Commit 1d728e1

Browse files
committed
Allow admins to see *all* challenges
1 parent 961c209 commit 1d728e1

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

src/actions/challenges.js

+15-3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ import { removeChallengeFromPhaseProduct, saveChallengeAsPhaseProduct } from '..
5858

5959
/**
6060
* Loads active challenges of project by page
61+
*
62+
* @param {number} page
63+
* @param {string} projectId
64+
* @param {string} status
65+
* @param {string} filterChallengeName
66+
* @param {bool} selfService
67+
* @param {string} userHandle this will be null for admin user(we will return all datas for admin user)
68+
* @param {string} filterChallengeType
69+
* @param {object} filterDate
70+
* @param {string} filterSortBy
71+
* @param {string} filterSortOrder
72+
* @param {number} perPage
73+
* @returns redux action
6174
*/
6275
export function loadChallengesByPage (
6376
page,
@@ -66,7 +79,6 @@ export function loadChallengesByPage (
6679
filterChallengeName = null,
6780
selfService = false,
6881
userHandle = null,
69-
filterCreatedBy = null,
7082
filterChallengeType = {},
7183
filterDate = {},
7284
filterSortBy = null,
@@ -126,8 +138,8 @@ export function loadChallengesByPage (
126138
if (filterSortBy) {
127139
filters['sortBy'] = filterSortBy
128140
}
129-
if (filterCreatedBy) {
130-
filters['createdBy'] = filterCreatedBy
141+
if (userHandle) {
142+
filters['createdBy'] = userHandle
131143
}
132144
if (filterSortOrder) {
133145
filters['sortOrder'] = filterSortOrder

src/components/ChallengesComponent/ChallengeList/index.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ class ChallengeList extends Component {
116116
searchText,
117117
selfService,
118118
this.getHandle(),
119-
this.getLoginHandle(),
120119
challengeType,
121120
challengeDate
122121
)
@@ -153,7 +152,6 @@ class ChallengeList extends Component {
153152
searchText,
154153
selfService,
155154
this.getHandle(),
156-
this.getLoginHandle(),
157155
filterChallengeType,
158156
filterDate,
159157
sortBy,
@@ -191,7 +189,6 @@ class ChallengeList extends Component {
191189
searchText,
192190
selfService,
193191
this.getHandle(),
194-
this.getLoginHandle(),
195192
filterChallengeType,
196193
filterDate,
197194
sortBy,
@@ -219,8 +216,7 @@ class ChallengeList extends Component {
219216
status,
220217
searchText,
221218
selfService,
222-
this.getHandle(),
223-
this.getLoginHandle()
219+
this.getHandle()
224220
)
225221
}
226222

@@ -298,7 +294,6 @@ class ChallengeList extends Component {
298294
searchText,
299295
selfService,
300296
this.getHandle(),
301-
this.getLoginHandle(),
302297
challengeType,
303298
challengeDate,
304299
name,
@@ -344,7 +339,6 @@ class ChallengeList extends Component {
344339
'',
345340
selfService,
346341
this.getHandle(),
347-
this.getLoginHandle(),
348342
null,
349343
{},
350344
null,

src/containers/Challenges/index.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ class Challenges extends Component {
6262
(nextProps.dashboard && this.props.dashboard !== nextProps.dashboard) ||
6363
this.props.activeProjectId !== nextProps.activeProjectId
6464
) {
65-
this.reloadChallenges(nextProps, false, true)
65+
this.reloadChallenges(nextProps, false)
6666
}
6767
}
6868

69-
reloadChallenges (props, forceLoad, loadMyChallenge) {
69+
reloadChallenges (props, forceLoad) {
7070
const {
7171
activeProjectId,
7272
projectDetail: reduxProjectInfo,
@@ -84,8 +84,7 @@ class Challenges extends Component {
8484
dashboard ? 'all' : '',
8585
'',
8686
selfService,
87-
isAdmin ? null : this.props.auth.user.handle,
88-
loadMyChallenge ? this.props.auth.user.handle : ''
87+
isAdmin ? null : this.props.auth.user.handle
8988
)
9089
const projectLoading =
9190
window.localStorage.getItem('projectLoading') !== null

0 commit comments

Comments
 (0)