Skip to content

[PROD RELEASE] - release pm1093 #1642

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

Merged
merged 1 commit into from
Apr 17, 2025
Merged

[PROD RELEASE] - release pm1093 #1642

merged 1 commit into from
Apr 17, 2025

Conversation

hentrymartin
Copy link
Collaborator

@hentrymartin hentrymartin commented Apr 16, 2025

What's in this PR?

@@ -25,7 +25,7 @@ import Loader from '../../Loader'
import UpdateBillingAccount from '../../UpdateBillingAccount'

import { CHALLENGE_STATUS, PAGE_SIZE, PAGINATION_PER_PAGE_OPTIONS, PROJECT_ROLES } from '../../../config/constants'
import { checkAdmin, checkReadOnlyRoles } from '../../../util/tc'
import { checkAdmin, checkManager, checkReadOnlyRoles } from '../../../util/tc'

Choose a reason for hiding this comment

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

The import statement has been updated to include checkManager. Ensure that checkManager is used appropriately in the code where necessary, and verify that it is defined and exported correctly from ../../../util/tc.

@@ -406,6 +406,9 @@ class ChallengeList extends Component {
} = this.props
const isReadOnly = checkReadOnlyRoles(this.props.auth.token) || loginUserRoleInProject === PROJECT_ROLES.READ
const isAdmin = checkAdmin(this.props.auth.token)
const isManager = checkManager(this.props.auth.token)

Choose a reason for hiding this comment

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

Consider checking if checkManager function is defined and imported correctly to ensure it works as expected.

@@ -406,6 +406,9 @@ class ChallengeList extends Component {
} = this.props
const isReadOnly = checkReadOnlyRoles(this.props.auth.token) || loginUserRoleInProject === PROJECT_ROLES.READ
const isAdmin = checkAdmin(this.props.auth.token)
const isManager = checkManager(this.props.auth.token)
const loginUserId = this.props.auth.user.userId

Choose a reason for hiding this comment

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

Ensure userId is a valid property of this.props.auth.user. Consider adding error handling if userId might be undefined.

@@ -406,6 +406,9 @@ class ChallengeList extends Component {
} = this.props
const isReadOnly = checkReadOnlyRoles(this.props.auth.token) || loginUserRoleInProject === PROJECT_ROLES.READ
const isAdmin = checkAdmin(this.props.auth.token)
const isManager = checkManager(this.props.auth.token)
const loginUserId = this.props.auth.user.userId
const isMemberOfActiveProject = activeProject && activeProject.members && activeProject.members.some(member => member.userId === loginUserId)

Choose a reason for hiding this comment

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

Consider adding a null check for activeProject.members before calling .some() to prevent potential runtime errors if members is undefined.

@@ -129,7 +131,7 @@ const UpdateBillingAccount = ({
!currentBillingAccount && (
<Fragment>
<span className={styles.error}>No Billing Account set</span>
{isAdmin && (
{(isAdmin || (isManager && isMemberOfActiveProject)) && (

Choose a reason for hiding this comment

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

The condition (isAdmin || (isManager && isMemberOfActiveProject)) could be simplified or clarified for better readability. Consider refactoring or adding parentheses to make the logic more explicit.

@@ -153,7 +155,7 @@ const UpdateBillingAccount = ({
>
{isBillingAccountExpired ? 'INACTIVE' : 'ACTIVE'}
</span>{' '}
{isAdmin && (
{(isAdmin || (isManager && isMemberOfActiveProject)) && (

Choose a reason for hiding this comment

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

The condition (isManager && isMemberOfActiveProject) has been added to the existing isAdmin check. Ensure that this logic aligns with the intended functionality and that both conditions are necessary for displaying the span. If this change is meant to alter access control, verify that the roles and project membership are correctly handled elsewhere in the code.

@@ -187,7 +189,9 @@ UpdateBillingAccount.propTypes = {
isBillingAccountExpired: PropTypes.bool,
isAdmin: PropTypes.bool,
projectId: PropTypes.number,
updateProject: PropTypes.func.isRequired
updateProject: PropTypes.func.isRequired,
isMemberOfActiveProject: PropTypes.bool.isRequired,

Choose a reason for hiding this comment

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

The isMemberOfActiveProject prop is marked as isRequired, but ensure that this prop is always provided where UpdateBillingAccount is used, otherwise it could lead to runtime errors.

updateProject: PropTypes.func.isRequired
updateProject: PropTypes.func.isRequired,
isMemberOfActiveProject: PropTypes.bool.isRequired,
isManager: PropTypes.bool.isRequired

Choose a reason for hiding this comment

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

The isManager prop is marked as isRequired, but ensure that this prop is always provided where UpdateBillingAccount is used, otherwise it could lead to runtime errors.

@hentrymartin hentrymartin changed the title fix: release pm1093 [PROD RELEASE] - release pm1093 Apr 16, 2025
@hentrymartin hentrymartin requested a review from kkartunov April 16, 2025 16:39
@kkartunov kkartunov merged commit 67d387c into master Apr 17, 2025
3 checks passed
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