Skip to content

Commit 5e6f307

Browse files
authored
Merge pull request #1563 from topcoder-platform/develop
Prod deploy Aug 18 2023 - v20.12
2 parents d097e7b + 682dae9 commit 5e6f307

File tree

12 files changed

+141
-246
lines changed

12 files changed

+141
-246
lines changed

src/actions/users.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Sidebar related redux actions
3+
*/
4+
import { fetchMemberProjects } from '../services/projects'
5+
import {
6+
LOAD_ALL_USER_PROJECTS_PENDING,
7+
LOAD_ALL_USER_PROJECTS_SUCCESS,
8+
LOAD_ALL_USER_PROJECTS_FAILURE
9+
} from '../config/constants'
10+
11+
/**
12+
* Loads projects of the authenticated user
13+
*/
14+
export function loadAllUserProjects (isAdmin = true) {
15+
return (dispatch) => {
16+
dispatch({
17+
type: LOAD_ALL_USER_PROJECTS_PENDING
18+
})
19+
20+
const filters = {
21+
status: 'active',
22+
sort: 'lastActivityAt desc'
23+
}
24+
if (!isAdmin) {
25+
filters['memberOnly'] = true
26+
}
27+
28+
fetchMemberProjects(filters).then(projects => dispatch({
29+
type: LOAD_ALL_USER_PROJECTS_SUCCESS,
30+
projects
31+
})).catch(() => dispatch({
32+
type: LOAD_ALL_USER_PROJECTS_FAILURE
33+
}))
34+
}
35+
}

src/components/ChallengeEditor/ChallengeView/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ const ChallengeView = ({
207207
)}
208208
</>
209209
)}
210+
<div className={styles.row}>
211+
<div className={styles.col}>
212+
<span className={styles.fieldTitle}>Timezone:</span>
213+
{Intl.DateTimeFormat().resolvedOptions().timeZone}
214+
</div>
215+
</div>
210216
{
211217
challenge.legacy.subTrack === 'WEB_DESIGNS' && challenge.phases.length === 8 ? phases.map((phase, index) => (
212218
<PhaseInput

src/components/ChallengeEditor/Resources/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ export default class Resources extends React.Component {
161161
const currentPhase = getCurrentPhase(challenge).toLowerCase()
162162
const isCurrentPhasesNotSubmissionOrRegistration = _.every(['submission', 'registration'], (phase) => currentPhase.indexOf(phase) < 0)
163163
const exceptionHandlesDeleteList = {}
164-
// The creator of the challenge can't be deleted
165-
exceptionHandlesDeleteList[challenge.createdBy] = true
166164
_.forEach(submissions, (s) => {
167165
// do not allow to delete submitters who submitted
168166
exceptionHandlesDeleteList[s.createdBy] = true
@@ -182,13 +180,26 @@ export default class Resources extends React.Component {
182180
], (status) => challenge.status.toUpperCase() === status)
183181
) {
184182
if (
183+
// The creator of the challenge can't be deleted
184+
resourceItem.memberHandle === challenge.createdBy
185+
) {
186+
// where the copilot has multiple roles, we should allow the additional roles to be deleted, but not the copilot role
187+
if (`${resourceItem.role}`.toLowerCase().indexOf('copilot') >= 0) {
188+
exceptionResourceIdDeleteList[resourceItem.id] = true
189+
}
190+
} else if (
185191
// Copilots can't delete themselves from the challenge
186192
loggedInUserResource &&
187193
_.some(loggedInUserResource.roles, (role) => `${role}`.toLowerCase().indexOf('copilot') >= 0) &&
188194
loggedInUserResource.memberHandle === resourceItem.memberHandle
189195
) {
190196
exceptionResourceIdDeleteList[resourceItem.id] = true
191197
}
198+
} else if (
199+
// The creator of the challenge can't be deleted
200+
resourceItem.memberHandle === challenge.createdBy
201+
) {
202+
exceptionResourceIdDeleteList[resourceItem.id] = true
192203
} else if (
193204
// If the current phase is not submission or registration
194205
// then we will disable removing reviewers and copilots.

src/components/ChallengeEditor/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,12 @@ class ChallengeEditor extends Component {
17491749
)}
17501750
{!isTask && (
17511751
<>
1752+
<div className={styles.row}>
1753+
<div className={styles.col}>
1754+
<span className={styles.fieldTitle}>Timezone:</span>
1755+
{Intl.DateTimeFormat().resolvedOptions().timeZone}
1756+
</div>
1757+
</div>
17521758
{
17531759
phases.map((phase, index) => (
17541760
<PhaseInput

src/components/Sidebar/Sidebar.module.scss

Lines changed: 0 additions & 66 deletions
This file was deleted.

src/components/Sidebar/index.js

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/config/constants.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ export const LOAD_PROJECTS_PENDING = 'LOAD_PROJECTS_PENDING'
5757
export const LOAD_PROJECTS_FAILURE = 'LOAD_PROJECTS_FAILURE'
5858
export const UNLOAD_PROJECTS_SUCCESS = 'UNLOAD_PROJECTS_SUCCESS'
5959

60+
export const LOAD_ALL_USER_PROJECTS_SUCCESS = 'LOAD_ALL_USER_PROJECTS_SUCCESS'
61+
export const LOAD_ALL_USER_PROJECTS_PENDING = 'LOAD_ALL_USER_PROJECTS_PENDING'
62+
export const LOAD_ALL_USER_PROJECTS_FAILURE = 'LOAD_ALL_USER_PROJECTS_FAILURE'
63+
6064
// project billingAccount
6165
export const LOAD_PROJECT_BILLING_ACCOUNT = 'LOAD_PROJECT_BILLING_ACCOUNT'
6266
export const LOAD_PROJECT_BILLING_ACCOUNT_PENDING = 'LOAD_PROJECT_BILLING_ACCOUNT_PENDING'

src/containers/Sidebar/index.js

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)