Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
5ce15aa
Cleanup old code for the review scorecard ui
vas3a Dec 4, 2025
3b1193a
fix: allow only admins and reviewer to respond to appeals
hentrymartin Dec 5, 2025
0361d8c
fix: lint
hentrymartin Dec 5, 2025
985e16a
Merge pull request #1361 from topcoder-platform/pm-3141
hentrymartin Dec 8, 2025
1468bd4
fix: filter submissions to design challenges if its configured that way
hentrymartin Dec 8, 2025
57b48d3
fix: can view submissions
hentrymartin Dec 8, 2025
6528746
fix: lint
hentrymartin Dec 8, 2025
d37b511
fix: lint
hentrymartin Dec 8, 2025
195226c
fix: lint
hentrymartin Dec 8, 2025
d088964
Merge pull request #1364 from topcoder-platform/pm-2662_1
hentrymartin Dec 8, 2025
951de7d
Merge pull request #1359 from topcoder-platform/cleanup-old-review-sc…
kkartunov Dec 9, 2025
c3baec0
point tc deps to master & npm minor update
kkartunov Dec 9, 2025
65eec2d
ci: deploy to dev env
kkartunov Dec 9, 2025
d6462df
back to auth-lib-v2
kkartunov Dec 9, 2025
da81018
fix: directly open scorecard in edit mode
hentrymartin Dec 10, 2025
5a25ed2
fix: revalidate appeals and response
hentrymartin Dec 10, 2025
d216fde
fix: revalidate appeals and response
hentrymartin Dec 10, 2025
b111246
fix: lint
hentrymartin Dec 10, 2025
548b0c4
fix: lint
hentrymartin Dec 10, 2025
7fd1d25
fix: restrict reviews in review tab for design challenge with config …
hentrymartin Dec 11, 2025
b6ed3ed
fix: lint
hentrymartin Dec 11, 2025
995d81e
fix: lint
hentrymartin Dec 11, 2025
75664d7
update yarn.lock
kkartunov Dec 11, 2025
2e1fc7d
Merge pull request #1367 from topcoder-platform/pm-2662_2
kkartunov Dec 11, 2025
0563cf0
fix trivy alerts
kkartunov Dec 11, 2025
b8d39fa
Merge branch 'dev' into security
kkartunov Dec 11, 2025
48816c5
ci: remove from dev
kkartunov Dec 11, 2025
3db7d1a
Merge pull request #1365 from topcoder-platform/security
kkartunov Dec 11, 2025
61ad75b
security fixes - high
kkartunov Dec 11, 2025
e564eed
Merge pull request #1369 from topcoder-platform/security
kkartunov Dec 11, 2025
5b01f5f
drop ssl serts
kkartunov Dec 11, 2025
72028ad
Merge pull request #1370 from topcoder-platform/security
kkartunov Dec 11, 2025
1b0df87
Merge pull request #1366 from topcoder-platform/pm-3141_1
kkartunov Dec 11, 2025
21226f2
fix: repond to appeals
hentrymartin Dec 11, 2025
12c4c64
fix: repond to appeals
hentrymartin Dec 11, 2025
d0a5e6d
fix: respond to appeals
hentrymartin Dec 11, 2025
86b03c8
fix: lint
hentrymartin Dec 11, 2025
4eb2201
fix: show only my winning results
hentrymartin Dec 11, 2025
8fac84b
fix: lint
hentrymartin Dec 11, 2025
5163510
Merge pull request #1371 from topcoder-platform/pm-3141_3
hentrymartin Dec 11, 2025
1ced8a1
Merge pull request #1372 from topcoder-platform/pm-2662_3
hentrymartin Dec 11, 2025
e9d4976
fix: show only submissions with passed screening score
hentrymartin Dec 11, 2025
6ae3ec0
fix: lint
hentrymartin Dec 11, 2025
d1cf5c6
Tweak this path to address 401 errors in the service
jmgasper Dec 11, 2025
23a62d1
Merge pull request #1373 from topcoder-platform/pm-2573
hentrymartin Dec 11, 2025
9ed7544
Merge pull request #1375 from topcoder-platform/master
kkartunov Dec 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ import {
BackendSubmission,
ChallengeDetailContextModel,
convertBackendSubmissionToSubmissionInfo,
ReviewAppContextModel,
SubmissionInfo,
} from '../../models'
import { TableNoRecord } from '../TableNoRecord'
import { TableWrapper } from '../TableWrapper'
import { SubmissionHistoryModal } from '../SubmissionHistoryModal'
import { useSubmissionDownloadAccess } from '../../hooks/useSubmissionDownloadAccess'
import type { UseSubmissionDownloadAccessResult } from '../../hooks/useSubmissionDownloadAccess'
import { ChallengeDetailContext } from '../../contexts'
import { ChallengeDetailContext, ReviewAppContext } from '../../contexts'
import {
challengeHasSubmissionLimit,
getSubmissionHistoryKey,
Expand All @@ -42,6 +43,7 @@ import {
import type { SubmissionHistoryPartition } from '../../utils'
import { TABLE_DATE_FORMAT } from '../../../config/index.config'
import { CollapsibleAiReviewsRow } from '../CollapsibleAiReviewsRow'
import { useRolePermissions, UseRolePermissionsResult } from '../../hooks'

import styles from './TabContentSubmissions.module.scss'

Expand All @@ -67,9 +69,36 @@ export const TabContentSubmissions: FC<Props> = props => {
isSubmissionDownloadRestrictedForMember,
getRestrictionMessageForMember,
}: UseSubmissionDownloadAccessResult = useSubmissionDownloadAccess()
const { loginUserInfo }: ReviewAppContextModel = useContext(ReviewAppContext)
const { canViewAllSubmissions }: UseRolePermissionsResult = useRolePermissions()

const { challengeInfo }: ChallengeDetailContextModel = useContext(ChallengeDetailContext)

const isCompletedDesignChallenge = useMemo(() => {
if (!challengeInfo) return false
const type = challengeInfo.track.name ? String(challengeInfo.track.name)
.toLowerCase() : ''
const status = challengeInfo.status ? String(challengeInfo.status)
.toLowerCase() : ''
return type === 'design' && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check the challenge type here as well? This will match F2Fs in addition to challenges.

status === 'completed'
)
}, [challengeInfo])

const isSubmissionsViewable = useMemo(() => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The isSubmissionsViewable function uses challengeInfo.metadata.some(...) which could potentially throw an error if challengeInfo.metadata is not an array. Consider adding a check to ensure challengeInfo.metadata is an array before calling .some().

if (!challengeInfo?.metadata?.length) return false
return challengeInfo.metadata.some(m => m.name === 'submissionsViewable' && String(m.value)
.toLowerCase() === 'true')
}, [challengeInfo])

const canViewSubmissions = useMemo(() => {
if (isCompletedDesignChallenge) {
return canViewAllSubmissions || isSubmissionsViewable
}

return true
}, [isCompletedDesignChallenge, isSubmissionsViewable, canViewAllSubmissions])

const submissionMetaById = useMemo(
() => {
const map = new Map<string, BackendSubmission>()
Expand Down Expand Up @@ -205,19 +234,32 @@ export const TabContentSubmissions: FC<Props> = props => {

const filteredSubmissions = useMemo<BackendSubmission[]>(
() => {

const filterFunc = (submissions: BackendSubmission[]): BackendSubmission[] => submissions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 maintainability]
The filterFunc is defined inside the useMemo hook but is used twice within the same scope. Consider defining filterFunc outside of useMemo to avoid redefining it unnecessarily, which could improve readability and maintainability.

.filter(submission => {
if (!canViewSubmissions) {
return String(submission.memberId) === String(loginUserInfo?.userId)
}

return true
})
const filteredByUserId = filterFunc(latestBackendSubmissions)
const filteredByUserIdSubmissions = filterFunc(props.submissions)
if (restrictToLatest && hasLatestFlag) {
return latestBackendSubmissions.length
? latestBackendSubmissions
: props.submissions
? filteredByUserId
: filteredByUserIdSubmissions
}

return props.submissions
return filteredByUserIdSubmissions
},
[
latestBackendSubmissions,
props.submissions,
restrictToLatest,
hasLatestFlag,
canViewSubmissions,
loginUserInfo?.userId,
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { get, includes } from 'lodash'
import { yupResolver } from '@hookform/resolvers/yup'
import { IconAppeal, IconEdit } from '~/apps/review/src/lib/assets/icons'
import { ADMIN, COPILOT, REVIEWER } from '~/apps/review/src/config/index.config'
import { useRolePermissions, UseRolePermissionsResult } from '~/apps/review/src/lib/hooks'

import {
AppealInfo,
Expand Down Expand Up @@ -44,6 +45,7 @@ const ReviewComment: FC<ReviewCommentProps> = props => {
addAppeal,
isSavingAppeal,
}: ScorecardViewerContextValue = useScorecardViewerContext()
const { isAdmin, hasReviewerRole }: UseRolePermissionsResult = useRolePermissions()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ security]
The useRolePermissions hook is used to determine role-based permissions. Ensure that this hook is correctly implemented and returns accurate role information, as incorrect role data could lead to unauthorized access or actions.


const { challengeInfo }: ChallengeDetailContextModel = useContext(
ChallengeDetailContext,
Expand Down Expand Up @@ -175,7 +177,7 @@ const ReviewComment: FC<ReviewCommentProps> = props => {
appeal={props.appeal}
reviewItem={props.reviewItem}
scorecardQuestion={props.question}
canRespondToAppeal={isReviewerRole}
canRespondToAppeal={isAdmin || hasReviewerRole}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The condition isAdmin || hasReviewerRole is used to determine if a user can respond to an appeal. Ensure that this logic aligns with the intended business rules, as incorrect permission checks could lead to unauthorized actions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this change for? Are we now allowing admins to respond to appeals? I'm not sure that's something we've done in the past?

>
{isSubmitter && canAddAppeal && (
<div className={styles.blockBtns}>
Expand Down

This file was deleted.

Loading
Loading