Skip to content

PM-4075 Fix manager comment access#1518

Open
himaniraghav3 wants to merge 1 commit intodevfrom
PM-4075
Open

PM-4075 Fix manager comment access#1518
himaniraghav3 wants to merge 1 commit intodevfrom
PM-4075

Conversation

@himaniraghav3
Copy link
Collaborator

Related JIRA Ticket:

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

What's in this PR?

We were only relying on search param to check who can add/edit comment
I added a check for roles - admin/manager/reviewer

const [isChanged, setIsChanged] = useState(false)
const respondToAppeals = searchParams.get('respondToAppeals') === 'true'
const [isManagerEdit, setIsManagerEdit] = useState(respondToAppeals)
const hasChallengeAdminRole = useMemo(

Choose a reason for hiding this comment

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

[💡 performance]
The useMemo hook is used here to compute hasChallengeAdminRole, but since the computation is simple and not computationally expensive, the use of useMemo might be unnecessary. Consider removing useMemo to simplify the code unless there is a specific performance concern.

[myChallengeResources],
)

const hasTopcoderAdminRole = useMemo(

Choose a reason for hiding this comment

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

[💡 performance]
The useMemo hook is used here to compute hasTopcoderAdminRole, but since the computation is simple and not computationally expensive, the use of useMemo might be unnecessary. Consider removing useMemo to simplify the code unless there is a specific performance concern.

[myChallengeRoles],
)

const hasChallengeManagerRole = useMemo(

Choose a reason for hiding this comment

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

[💡 performance]
The useMemo hook is used here to compute hasChallengeManagerRole, but since the computation is simple and not computationally expensive, the use of useMemo might be unnecessary. Consider removing useMemo to simplify the code unless there is a specific performance concern.

[myChallengeResources],
)

const canManagerEdit = useMemo(

Choose a reason for hiding this comment

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

[💡 performance]
The useMemo hook is used here to compute canManagerEdit, but since the computation is simple and not computationally expensive, the use of useMemo might be unnecessary. Consider removing useMemo to simplify the code unless there is a specific performance concern.

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.

1 participant