Skip to content

Commit bef9f45

Browse files
authored
Merge pull request #6872 from topcoder-platform/M2MHotfix
Submission download buttons
2 parents 4e5b629 + 96138b5 commit bef9f45

File tree

9 files changed

+24
-43
lines changed

9 files changed

+24
-43
lines changed

.circleci/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ workflows:
350350
branches:
351351
only:
352352
- PROD-4183
353+
- M2MHotfix
353354
# This is alternate dev env for parallel testing
354355
- "build-test":
355356
context : org-global

__tests__/shared/components/challenge-detail/Submissions/SubmissionRow/SubmissionHistoryRow/__snapshots__/index.jsx.snap

-21
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,6 @@ exports[`Matches shallow shapshot shapshot 1 1`] = `
5757
15:49:35
5858
</div>
5959
</div>
60-
<div
61-
className="src-shared-components-challenge-detail-Submissions-SubmissionRow-SubmissionHistoryRow-___style__col-2___2KjRa src-shared-components-challenge-detail-Submissions-SubmissionRow-SubmissionHistoryRow-___style__col___2-hjE src-shared-components-challenge-detail-Submissions-SubmissionRow-SubmissionHistoryRow-___style__center___2l_Ch"
62-
>
63-
<div
64-
className="src-shared-components-challenge-detail-Submissions-SubmissionRow-SubmissionHistoryRow-___style__mobile-header___3NsEQ"
65-
>
66-
Action
67-
</div>
68-
<button
69-
onClick={[Function]}
70-
type="button"
71-
>
72-
<DownloadIcon
73-
fill="none"
74-
height="18"
75-
viewBox="0 0 18 18"
76-
width="18"
77-
xmlns="http://www.w3.org/2000/svg"
78-
/>
79-
</button>
80-
</div>
8160
</div>
8261
</div>
8362
`;

__tests__/shared/components/challenge-detail/Submissions/SubmissionRow/SubmissionHistoryRow/index.jsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
// import ReactDOM from 'react-dom';
33
import Renderer from 'react-test-renderer/shallow';
4-
import TU from 'react-dom/test-utils';
4+
// import TU from 'react-dom/test-utils';
55
import SubmissionHistoryRow from 'components/challenge-detail/Submissions/SubmissionRow/SubmissionHistoryRow';
66

77
const mockData = {
@@ -32,14 +32,14 @@ describe('Matches shallow shapshot', () => {
3232
});
3333
});
3434

35+
/*
3536
class Wrapper extends React.Component {
3637
componentDidMount() {}
3738
3839
render() {
3940
return <SubmissionHistoryRow {...this.props} />;
4041
}
4142
}
42-
4343
describe('render properly', () => {
4444
test('click', () => {
4545
const instance = TU.renderIntoDocument((<Wrapper {...mockData} />));
@@ -48,3 +48,4 @@ describe('render properly', () => {
4848
TU.Simulate.click(matches[0]);
4949
});
5050
});
51+
*/

__tests__/shared/components/challenge-detail/Winners/Winner/__snapshots__/index.jsx.snap

+1-14
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,6 @@ exports[`Matches shallow shapshot shapshot 1 1`] = `
5555
</div>
5656
<div
5757
className="src-shared-components-challenge-detail-Winners-Winner-___style__download-container___OXVza"
58-
>
59-
<button
60-
onClick={[Function]}
61-
type="button"
62-
>
63-
<DownloadIcon
64-
fill="none"
65-
height="18"
66-
viewBox="0 0 18 18"
67-
width="18"
68-
xmlns="http://www.w3.org/2000/svg"
69-
/>
70-
</button>
71-
</div>
58+
/>
7259
</div>
7360
`;

__tests__/shared/components/challenge-detail/Winners/Winner/index.jsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
// import ReactDOM from 'react-dom';
33
import Renderer from 'react-test-renderer/shallow';
4-
import TU from 'react-dom/test-utils';
4+
// import TU from 'react-dom/test-utils';
55
import Winner from 'components/challenge-detail/Winners/Winner';
66

77
const mockData = {
@@ -53,14 +53,14 @@ describe('Matches shallow shapshot', () => {
5353
});
5454
});
5555

56+
/*
5657
class Wrapper extends React.Component {
5758
componentDidMount() {}
5859
5960
render() {
6061
return <Winner {...this.props} />;
6162
}
6263
}
63-
6464
describe('render properly', () => {
6565
test('click', () => {
6666
const instance = TU.renderIntoDocument((<Wrapper {...mockData} />));
@@ -69,3 +69,4 @@ describe('render properly', () => {
6969
TU.Simulate.click(matches[0]);
7070
});
7171
});
72+
*/

src/shared/components/challenge-detail/Submissions/SubmissionRow/SubmissionHistoryRow/index.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export default function SubmissionHistoryRow({
3434
submissionId,
3535
isLoggedIn,
3636
}) {
37+
// todo: hide download button until update submissions API
38+
const hideDownloadForMMRDM = true;
3739
const getInitialReviewResult = () => {
3840
if (provisionalScore && provisionalScore < 0) return <FailedSubmissionTooltip />;
3941
switch (status) {
@@ -82,7 +84,7 @@ export default function SubmissionHistoryRow({
8284
</div>
8385
</div>
8486
{
85-
isLoggedIn && (isMM || isRDM)
87+
!hideDownloadForMMRDM && isLoggedIn && (isMM || isRDM)
8688
&& (numWinners > 0 || challengeStatus === CHALLENGE_STATUS.COMPLETED) && (
8789
<div styleName="col-2 col center">
8890
<div styleName="mobile-header">Action</div>

src/shared/components/challenge-detail/Submissions/index.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ class SubmissionsComponent extends React.Component {
307307
type,
308308
tags,
309309
} = challenge;
310+
// todo: hide download button until update submissions API
311+
const hideDownloadForMMRDM = true;
310312

311313
const isMM = this.isMM();
312314
const isRDM = checkIsRDM(challenge);
@@ -479,7 +481,8 @@ class SubmissionsComponent extends React.Component {
479481
}
480482
<div styleName={`${viewAsTable ? 'view-as-table' : ''}`}>
481483
{
482-
((numWinners > 0 || challenge.status === CHALLENGE_STATUS.COMPLETED)
484+
(!hideDownloadForMMRDM
485+
&& (numWinners > 0 || challenge.status === CHALLENGE_STATUS.COMPLETED)
483486
&& (isMM || isRDM) && isLoggedIn) && (
484487
<div styleName="block-download-all">
485488
<button

src/shared/components/challenge-detail/Winners/Winner/index.jsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export default function Winner({
2727
isLoggedIn,
2828
auth,
2929
}) {
30+
// todo: hide download button until update submissions API
31+
const hideDownloadForMMRDM = true;
3032
const [windowOrigin, setWindowOrigin] = useState();
3133
useEffect(() => {
3234
setWindowOrigin(window.origin);
@@ -90,7 +92,9 @@ export default function Winner({
9092
</div>
9193
<div styleName="download-container">
9294
{
93-
((!winner.submissionDownloadLink || !viewable) && (isMM || isRDM) && isLoggedIn) && (
95+
(!hideDownloadForMMRDM
96+
&& (!winner.submissionDownloadLink || !viewable)
97+
&& (isMM || isRDM) && isLoggedIn) && (
9498
<button
9599
onClick={() => {
96100
// download submission

src/shared/components/challenge-detail/Winners/index.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@ export default function Winners({
2727
auth,
2828
challengeStatus,
2929
}) {
30+
// todo: hide download button until update submissions API
31+
const hideDownloadForMMRDM = true;
3032
const [downloadingAll, setDownloadingAll] = useState(false);
3133
return (
3234
<div styleName="container">
3335
{
34-
((winners.length > 0 || challengeStatus === CHALLENGE_STATUS.COMPLETED)
36+
!hideDownloadForMMRDM
37+
&& ((winners.length > 0 || challengeStatus === CHALLENGE_STATUS.COMPLETED)
3538
&& (isMM || isRDM) && isLoggedIn) && (
3639
<div styleName="block-download-all">
3740
<button

0 commit comments

Comments
 (0)