-
Notifications
You must be signed in to change notification settings - Fork 21
[HOTFIX] - Fix broken review UI flow #1381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3f4c928
99c96d7
020c230
6bd27a9
01a64b8
92a3962
f1ffcf0
3ec6382
730a58a
4b24324
667ea4e
2f91e54
ed1eccb
22737bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -226,7 +226,6 @@ workflows: | |
| branches: | ||
| only: | ||
| - dev | ||
| - pm-3141_3 | ||
|
|
||
| - deployQa: | ||
| context: org-global | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -319,10 +319,11 @@ export const TableAppealsResponse: FC<TableAppealsResponseProps> = (props: Table | |
| const scoreVisibilityConfig = useMemo<ScoreVisibilityConfig>( | ||
| () => ({ | ||
| canDisplayScores: () => true, | ||
| canRespondToAppeals, | ||
| canViewScorecard: true, | ||
| isAppealsTab: false, | ||
| }), | ||
| [], | ||
| [canRespondToAppeals], | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| ) | ||
|
|
||
| const columns = useMemo<TableColumn<SubmissionRow>[]>(() => { | ||
|
|
@@ -467,7 +468,7 @@ export const TableAppealsResponse: FC<TableAppealsResponseProps> = (props: Table | |
| > | ||
| <Link | ||
| className={styles.respondButton} | ||
| to={getReviewRoute(submission.id, reviewId)} | ||
| to={getReviewRoute(submission.id, reviewId, canRespondToAppeals)} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| > | ||
| Respond to Appeals | ||
| </Link> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,21 +266,11 @@ export const TableReview: FC<TableReviewProps> = (props: TableReviewProps) => { | |
| const minimumPassingScoreByScorecardId = useScorecardPassingScores(scorecardIds) | ||
|
|
||
| const aggregatedRows = useMemo<SubmissionRow[]>(() => { | ||
| const rows = aggregatedSubmissionRows | ||
| .filter(aggregated => { | ||
| const reviews = aggregated.reviews ?? [] | ||
| const myReviewDetail = reviews.find(review => { | ||
| const resourceId = review.reviewInfo?.resourceId ?? review.resourceId | ||
| return resourceId ? myReviewerResourceIds.has(resourceId) : false | ||
| }) | ||
|
|
||
| return !!myReviewDetail?.reviewId | ||
| }) | ||
| .map(aggregated => ({ | ||
| ...(aggregated.submission ?? {}), | ||
| ...aggregated.submission, | ||
| aggregated, | ||
| })) as SubmissionRow[] | ||
| const rows = aggregatedSubmissionRows.map(aggregated => ({ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| ...(aggregated.submission ?? {}), | ||
| ...aggregated.submission, | ||
| aggregated, | ||
| })) as SubmissionRow[] | ||
|
|
||
| if (!restrictToLatest) { | ||
| return rows | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -522,6 +522,7 @@ export function renderScoreCell( | |
| canViewScorecard, | ||
| viewOwnScorecardTooltip = VIEW_OWN_SCORECARD_TOOLTIP, | ||
| getReviewUrl, | ||
| canRespondToAppeals, | ||
| }: ScoreVisibilityConfig = configWithDefaults | ||
|
|
||
| const reviewDetail = submission.aggregated?.reviews?.[reviewIndex] | ||
|
|
@@ -585,7 +586,9 @@ export function renderScoreCell( | |
| ) | ||
| } | ||
|
|
||
| const reviewUrl = getReviewUrl ? getReviewUrl(reviewId) : getReviewRoute(submission.id, reviewId) | ||
| const reviewUrl = getReviewUrl | ||
| ? getReviewUrl(reviewId) | ||
| : getReviewRoute(submission.id, reviewId, canRespondToAppeals) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
|
|
||
| return ( | ||
| <div className={styles.scoreReopenBlock}> | ||
|
|
@@ -615,6 +618,7 @@ export function renderAppealsCell( | |
| canViewScorecard, | ||
| viewOwnScorecardTooltip = VIEW_OWN_SCORECARD_TOOLTIP, | ||
| getReviewUrl, | ||
| canRespondToAppeals, | ||
| }: ScoreVisibilityConfig = configWithDefaults | ||
|
|
||
| const reviewDetail = submission.aggregated?.reviews?.[reviewIndex] | ||
|
|
@@ -668,7 +672,9 @@ export function renderAppealsCell( | |
| ) | ||
| } | ||
|
|
||
| const reviewUrl = getReviewUrl ? getReviewUrl(reviewId) : getReviewRoute(submission.id, reviewId) | ||
| const reviewUrl = getReviewUrl | ||
| ? getReviewUrl(reviewId) | ||
| : getReviewRoute(submission.id, reviewId, canRespondToAppeals) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
|
|
||
| return ( | ||
| <Link | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,9 +112,14 @@ export function findMetadataPhaseMatch( | |
| return { source: 'stringExact' } | ||
| } | ||
|
|
||
| const escapedTarget = escapeRegexLiteral(target) | ||
| .replace(/ /g, '\\ ') | ||
| const sepInsensitive = new RegExp(`\\b${escapedTarget.replace(/\\ /g, '[-_\\s]+')}\\b`) | ||
| // Replace all sequences of space, underscore, or hyphen in the target with a placeholder | ||
| const WORDSEP_PLACEHOLDER = '__WORDSEP__' | ||
| const sepPattern = /[ \-_]+/g | ||
| const targetWithPlaceholder = target.replace(sepPattern, WORDSEP_PLACEHOLDER) | ||
| // Properly escape ALL regex metacharacters (including backslash), leaving the placeholder intact | ||
| const escapedTarget = escapeRegexLiteral(targetWithPlaceholder) | ||
| .replace(new RegExp(escapeRegexLiteral(WORDSEP_PLACEHOLDER), 'g'), '[-_\\s]+') | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| const sepInsensitive = new RegExp(`\\b${escapedTarget}\\b`) | ||
| if (sepInsensitive.test(normalizedMetadata)) { | ||
| return { source: 'stringBoundary' } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ const CHALLENGE_DETAILS_SEGMENT = /(active-challenges|past-challenges)\/([^/]+)\ | |
| export function getReviewRoute( | ||
| submissionId: string, | ||
| reviewId: string, | ||
| addRespondToAppeals?: boolean, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
| currentPathname?: string, | ||
| ): string { | ||
| const encodedReviewId = encodeURIComponent(reviewId) | ||
|
|
@@ -26,7 +27,9 @@ export function getReviewRoute( | |
| ? `${prefix}/${match[1]}/${match[2]}` | ||
| : `/${match[1]}/${match[2]}` | ||
|
|
||
| return `${basePath}/reviews/${submissionId}?reviewId=${encodedReviewId}&respondToAppeals=true` | ||
| const respondToAppeals = addRespondToAppeals ? '&respondToAppeals=true' : '' | ||
|
|
||
| return `${basePath}/reviews/${submissionId}?reviewId=${encodedReviewId}${respondToAppeals}` | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[⚠️
correctness]The addition of
canAddManagerCommentto the condition ensures that the button to add a manager comment is only shown when it is allowed. Verify thatcanAddManagerCommentis correctly set in all contexts where this component is used to avoid unexpected behavior.