Skip to content

PM-2587 - show submitter details#1448

Merged
vas3a merged 2 commits intodevfrom
PM-2587_review-app
Feb 3, 2026
Merged

PM-2587 - show submitter details#1448
vas3a merged 2 commits intodevfrom
PM-2587_review-app

Conversation

@vas3a
Copy link
Collaborator

@vas3a vas3a commented Feb 3, 2026

Related JIRA Ticket:

https://topcoder.atlassian.net/browse/PM-2587

What's in this PR?

Render submitter info in submission tab for copilot & PM


return (
<div>
<a href={profileUrl} style={{ color: resolvedColor }} target='_blank' rel='noreferrer'>
Copy link

Choose a reason for hiding this comment

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

[❗❗ security]
The target='_blank' attribute is used without rel='noopener noreferrer', which can pose a security risk by allowing the new page to access the window.opener property. Ensure rel='noopener noreferrer' is included to mitigate this risk.

() => challengeSubmissions.map(convertBackendSubmissionToSubmissionInfo),
[challengeSubmissions],
() => challengeSubmissions.map(s => convertBackendSubmissionToSubmissionInfo(s, registrants)),
[challengeSubmissions, registrants],
Copy link

Choose a reason for hiding this comment

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

[⚠️ performance]
Adding registrants to the dependency array of useMemo is correct to ensure that submissionInfos is recalculated when registrants changes. However, ensure that registrants is stable and doesn't change unnecessarily, as this could lead to unnecessary recalculations.

*/
export function convertBackendSubmissionToSubmissionInfo(
data: BackendSubmission,
registrants?: BackendResource[] | undefined,
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The registrants parameter is marked as optional, but the function logic assumes it can be an array. Consider handling the case where registrants is undefined more explicitly to avoid potential runtime errors.

const registrantMap = new Map<string, BackendResource>()
if (Array.isArray(registrants)) {
registrants.forEach(r => {
if (r?.memberId !== undefined && r?.memberId !== null) {
Copy link

Choose a reason for hiding this comment

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

[💡 readability]
The check r?.memberId !== undefined && r?.memberId !== null can be simplified to r?.memberId != null to handle both undefined and null in a more concise way.

submittedDate,
submittedDateString,
type: data.type,
userInfo: registrantMap.get(data.memberId),
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The use of registrantMap.get(data.memberId) assumes that data.memberId is always a valid key in the map. Consider adding a fallback or error handling for cases where data.memberId might not exist in registrantMap.

<a href={profileUrl} style={{ color: resolvedColor }} target='_blank' rel='noreferrer'>
{handle}
</a>
{userInfo?.memberEmail ? (
Copy link

Choose a reason for hiding this comment

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

[💡 maintainability]
The condition userInfo?.memberEmail is checked twice, once in the ternary condition and again inside the block. Consider simplifying by removing the redundant check.

@vas3a vas3a merged commit dbab05d into dev Feb 3, 2026
8 checks passed
@vas3a vas3a deleted the PM-2587_review-app branch February 3, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants