-
Notifications
You must be signed in to change notification settings - Fork 51
[PROD RELEASE] - WorkManager Changes - Connect Decommission #1633
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
ff855cf
a70e1a5
4d24155
6a43f63
619b5c0
1dee45f
a0fe205
374be0c
c7d59d7
1b719fb
441e6d7
592a0f3
4fd1543
81a1173
06ab559
90f0395
41329e1
7eccfe3
18768fd
592b787
5823808
b184e86
125cf7d
8af3cf0
9605fa2
530c136
3ddfca7
cf7491a
eedc3ff
ac1de1a
cf73dbc
392e5f4
de59094
52fb0ab
91b2eb2
d907e6e
7c2a793
8255022
e6f13e0
de8f892
21d0574
2422565
5334423
7d0fcd9
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: AI PR Reviewer | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
permissions: | ||
pull-requests: write | ||
jobs: | ||
tc-ai-pr-review: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: TC AI PR Reviewer | ||
uses: topcoder-platform/tc-ai-pr-reviewer@master | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # The GITHUB_TOKEN is there by default so you just need to keep it like it is and not necessarily need to add it as secret as it will throw an error. [More Details](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret) | ||
LAB45_API_KEY: ${{ secrets.LAB45_API_KEY }} | ||
exclude: "**/*.json, **/*.md, **/*.jpg, **/*.png, **/*.jpeg, **/*.bmp, **/*.webp" # Optional: exclude patterns separated by commas |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,8 @@ import { | |
UPDATE_PROJECT_FAILURE, | ||
ADD_PROJECT_ATTACHMENT_SUCCESS, | ||
UPDATE_PROJECT_ATTACHMENT_SUCCESS, | ||
REMOVE_PROJECT_ATTACHMENT_SUCCESS | ||
REMOVE_PROJECT_ATTACHMENT_SUCCESS, | ||
LOAD_PROJECT_INVITES | ||
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. It looks like a new constant |
||
} from '../config/constants' | ||
import { | ||
fetchProjectById, | ||
|
@@ -30,9 +31,10 @@ import { | |
createProjectApi, | ||
fetchBillingAccounts, | ||
fetchMemberProjects, | ||
updateProjectApi | ||
updateProjectApi, | ||
getProjectInvites | ||
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. Please ensure that |
||
} from '../services/projects' | ||
import { checkAdmin } from '../util/tc' | ||
import { checkAdmin, checkManager } from '../util/tc' | ||
|
||
function _loadProjects (projectNameOrIdFilter = '', paramFilters = {}) { | ||
return (dispatch, getState) => { | ||
|
@@ -54,7 +56,7 @@ function _loadProjects (projectNameOrIdFilter = '', paramFilters = {}) { | |
} | ||
} | ||
|
||
if (!checkAdmin(getState().auth.token)) { | ||
if (!checkAdmin(getState().auth.token) && !checkManager(getState().auth.token)) { | ||
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. Consider checking if |
||
filters['memberOnly'] = true | ||
} | ||
|
||
|
@@ -171,6 +173,18 @@ export function loadProjectTypes () { | |
} | ||
} | ||
|
||
/** | ||
* Loads project invites | ||
*/ | ||
export function loadProjectInvites (projectId) { | ||
return (dispatch) => { | ||
return dispatch({ | ||
type: LOAD_PROJECT_INVITES, | ||
payload: getProjectInvites(projectId) | ||
}) | ||
} | ||
} | ||
|
||
/** | ||
* Creates a project | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ import { | |
UNLOAD_PROJECTS_SUCCESS, | ||
PROJECTS_PAGE_SIZE | ||
} from '../config/constants' | ||
import { checkAdmin } from '../util/tc' | ||
import { checkAdmin, checkManager } from '../util/tc' | ||
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. The |
||
import _ from 'lodash' | ||
|
||
/** | ||
|
@@ -50,7 +50,7 @@ export function loadProjects (filterProjectName = '', paramFilters = {}) { | |
} | ||
} | ||
|
||
if (!checkAdmin(getState().auth.token)) { | ||
if (!checkAdmin(getState().auth.token) && !checkManager(getState().auth.token)) { | ||
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. Consider checking if |
||
filters['memberOnly'] = true | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,33 +10,55 @@ import { | |
SEARCH_USER_PROJECTS_SUCCESS, | ||
SEARCH_USER_PROJECTS_FAILURE | ||
} from '../config/constants' | ||
import _ from 'lodash' | ||
|
||
/** | ||
* Loads projects of the authenticated user | ||
*/ | ||
export function loadAllUserProjects (isAdmin = true) { | ||
return (dispatch) => { | ||
export function loadAllUserProjects (params, isAdmin = true, isManager = true) { | ||
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. The |
||
return (dispatch, getState) => { | ||
dispatch({ | ||
type: LOAD_ALL_USER_PROJECTS_PENDING | ||
}) | ||
|
||
const state = getState().users | ||
|
||
const filters = { | ||
status: 'active', | ||
sort: 'lastActivityAt desc' | ||
sort: 'lastActivityAt desc', | ||
perPage: 20, | ||
...params | ||
} | ||
if (!isAdmin) { | ||
|
||
if (!isAdmin && !isManager) { | ||
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. The condition |
||
filters['memberOnly'] = true | ||
} | ||
|
||
fetchMemberProjects(filters).then(({ projects }) => dispatch({ | ||
fetchMemberProjects(filters).then(({ projects, pagination }) => dispatch({ | ||
type: LOAD_ALL_USER_PROJECTS_SUCCESS, | ||
projects | ||
projects: _.uniqBy((filters.page ? state.allUserProjects || [] : []).concat(projects), 'id'), | ||
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. The use of |
||
total: pagination.xTotal, | ||
page: pagination.xPage | ||
})).catch(() => dispatch({ | ||
type: LOAD_ALL_USER_PROJECTS_FAILURE | ||
})) | ||
} | ||
} | ||
|
||
export function loadNextProjects (isAdmin = true, isManager = true) { | ||
return (dispatch, getState) => { | ||
const { page, total, allUserProjects } = getState().users | ||
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. In |
||
if (allUserProjects.length >= total) { | ||
return | ||
} | ||
|
||
loadAllUserProjects(_.assign({}, { | ||
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. Consider using a constant or configuration setting for |
||
perPage: 20, | ||
page: page + 1 | ||
}), isAdmin, isManager)(dispatch, getState) | ||
} | ||
} | ||
|
||
/** | ||
* Filter projects of the authenticated user | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,11 +8,11 @@ import { PROJECT_STATUSES } from '../../config/constants' | |
|
||
import styles from './ProjectCard.module.scss' | ||
|
||
const ProjectCard = ({ projectName, projectStatus, projectId, selected }) => { | ||
const ProjectCard = ({ projectName, projectStatus, projectId, selected, isInvited }) => { | ||
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. Consider adding a default value for the |
||
return ( | ||
<div className={styles.container}> | ||
<Link | ||
to={`/projects/${projectId}/challenges`} | ||
to={`/projects/${projectId}/${isInvited ? 'invitation' : 'challenges'}`} | ||
className={cn(styles.projectName, { [styles.selected]: selected })} | ||
> | ||
<div className={styles.name}> | ||
|
@@ -28,6 +28,7 @@ ProjectCard.propTypes = { | |
projectStatus: PT.string.isRequired, | ||
projectId: PT.number.isRequired, | ||
projectName: PT.string.isRequired, | ||
isInvited: PT.bool.isRequired, | ||
selected: PT.bool | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import _ from 'lodash' | ||
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. It seems that lodash is imported but not used in this file. Consider removing the import if it's not needed. |
||
import moment from 'moment' | ||
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. The 'moment' library is imported but not used in this file. Consider removing the import if it's not necessary. |
||
import React, { Component } from 'react' | ||
import PropTypes from 'prop-types' | ||
import cn from 'classnames' | ||
|
@@ -6,7 +8,6 @@ import { PROJECT_ROLES } from '../../config/constants' | |
import PrimaryButton from '../Buttons/PrimaryButton' | ||
import AlertModal from '../Modal/AlertModal' | ||
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. The lodash library import has been removed, but it's not clear if all usages of lodash have been refactored or removed from the code. Please ensure that any lodash functions previously used in this file are either replaced with native JavaScript alternatives or are no longer needed. |
||
import { updateProjectMemberRole } from '../../services/projects' | ||
import _ from 'lodash' | ||
|
||
const theme = { | ||
container: styles.modalContainer | ||
|
@@ -58,7 +59,7 @@ class UserCard extends Component { | |
} | ||
|
||
render () { | ||
const { user, onRemoveClick, isEditable } = this.props | ||
const { isInvite, user, onRemoveClick, isEditable } = this.props | ||
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. The |
||
const showRadioButtons = _.includes(_.values(PROJECT_ROLES), user.role) | ||
return ( | ||
<div> | ||
|
@@ -90,76 +91,90 @@ class UserCard extends Component { | |
)} | ||
<div className={styles.item}> | ||
<div className={cn(styles.col5)}> | ||
{user.handle} | ||
</div> | ||
<div className={cn(styles.col5)}> | ||
{showRadioButtons && (<div className={styles.tcRadioButton}> | ||
<input | ||
name={`user-${user.id}`} | ||
type='radio' | ||
id={`read-${user.id}`} | ||
checked={user.role === PROJECT_ROLES.READ} | ||
onChange={(e) => e.target.checked && this.updatePermission(PROJECT_ROLES.READ)} | ||
/> | ||
<label className={cn({ [styles.isDisabled]: !isEditable })} htmlFor={`read-${user.id}`}> | ||
<div> | ||
Read | ||
</div> | ||
<input type='hidden' /> | ||
</label> | ||
</div>)} | ||
</div> | ||
<div className={cn(styles.col5)}> | ||
{showRadioButtons && (<div className={styles.tcRadioButton}> | ||
<input | ||
name={`user-${user.id}`} | ||
type='radio' | ||
id={`write-${user.id}`} | ||
checked={user.role === PROJECT_ROLES.WRITE} | ||
onChange={(e) => e.target.checked && this.updatePermission(PROJECT_ROLES.WRITE)} | ||
/> | ||
<label className={cn({ [styles.isDisabled]: !isEditable })} htmlFor={`write-${user.id}`}> | ||
<div> | ||
Write | ||
</div> | ||
<input type='hidden' /> | ||
</label> | ||
</div>)} | ||
</div> | ||
<div className={cn(styles.col5)}> | ||
{showRadioButtons && (<div className={styles.tcRadioButton}> | ||
<input | ||
name={`user-${user.id}`} | ||
type='radio' | ||
id={`full-access-${user.id}`} | ||
checked={user.role === PROJECT_ROLES.MANAGER} | ||
onChange={(e) => e.target.checked && this.updatePermission(PROJECT_ROLES.MANAGER)} | ||
/> | ||
<label className={cn({ [styles.isDisabled]: !isEditable })} htmlFor={`full-access-${user.id}`}> | ||
<div> | ||
Full Access | ||
</div> | ||
<input type='hidden' /> | ||
</label> | ||
</div>)} | ||
</div> | ||
<div className={cn(styles.col5)}> | ||
{showRadioButtons && (<div className={styles.tcRadioButton}> | ||
<input | ||
name={`user-${user.id}`} | ||
type='radio' | ||
id={`copilot-${user.id}`} | ||
checked={user.role === PROJECT_ROLES.COPILOT} | ||
onChange={(e) => e.target.checked && this.updatePermission(PROJECT_ROLES.COPILOT)} | ||
/> | ||
<label className={cn({ [styles.isDisabled]: !isEditable })} htmlFor={`copilot-${user.id}`}> | ||
<div> | ||
Copilot | ||
</div> | ||
<input type='hidden' /> | ||
</label> | ||
</div>)} | ||
{isInvite ? user.email : user.handle} | ||
</div> | ||
{!isInvite && ( | ||
<> | ||
<div className={cn(styles.col5)}> | ||
{showRadioButtons && (<div className={styles.tcRadioButton}> | ||
<input | ||
name={`user-${user.id}`} | ||
type='radio' | ||
id={`read-${user.id}`} | ||
checked={user.role === PROJECT_ROLES.READ} | ||
onChange={(e) => e.target.checked && this.updatePermission(PROJECT_ROLES.READ)} | ||
/> | ||
<label className={cn({ [styles.isDisabled]: !isEditable })} htmlFor={`read-${user.id}`}> | ||
<div> | ||
Read | ||
</div> | ||
<input type='hidden' /> | ||
</label> | ||
</div>)} | ||
</div> | ||
<div className={cn(styles.col5)}> | ||
{showRadioButtons && (<div className={styles.tcRadioButton}> | ||
<input | ||
name={`user-${user.id}`} | ||
type='radio' | ||
id={`write-${user.id}`} | ||
checked={user.role === PROJECT_ROLES.WRITE} | ||
onChange={(e) => e.target.checked && this.updatePermission(PROJECT_ROLES.WRITE)} | ||
/> | ||
<label className={cn({ [styles.isDisabled]: !isEditable })} htmlFor={`write-${user.id}`}> | ||
<div> | ||
Write | ||
</div> | ||
<input type='hidden' /> | ||
</label> | ||
</div>)} | ||
</div> | ||
<div className={cn(styles.col5)}> | ||
{showRadioButtons && (<div className={styles.tcRadioButton}> | ||
<input | ||
name={`user-${user.id}`} | ||
type='radio' | ||
id={`full-access-${user.id}`} | ||
checked={user.role === PROJECT_ROLES.MANAGER} | ||
onChange={(e) => e.target.checked && this.updatePermission(PROJECT_ROLES.MANAGER)} | ||
/> | ||
<label className={cn({ [styles.isDisabled]: !isEditable })} htmlFor={`full-access-${user.id}`}> | ||
<div> | ||
Full Access | ||
</div> | ||
<input type='hidden' /> | ||
</label> | ||
</div>)} | ||
</div> | ||
<div className={cn(styles.col5)}> | ||
{showRadioButtons && (<div className={styles.tcRadioButton}> | ||
<input | ||
name={`user-${user.id}`} | ||
type='radio' | ||
id={`copilot-${user.id}`} | ||
checked={user.role === PROJECT_ROLES.COPILOT} | ||
onChange={(e) => e.target.checked && this.updatePermission(PROJECT_ROLES.COPILOT)} | ||
/> | ||
<label className={cn({ [styles.isDisabled]: !isEditable })} htmlFor={`copilot-${user.id}`}> | ||
<div> | ||
Copilot | ||
</div> | ||
<input type='hidden' /> | ||
</label> | ||
</div>)} | ||
</div> | ||
</> | ||
)} | ||
{isInvite && ( | ||
<> | ||
<div className={cn(styles.col5)} /> | ||
<div className={cn(styles.col5)}> | ||
Invited {moment(user.createdAt).format('MMM D, YY')} | ||
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. Consider handling the case where |
||
</div> | ||
<div className={cn(styles.col5)} /> | ||
<div className={cn(styles.col5)} /> | ||
</> | ||
)} | ||
{isEditable ? (<div className={cn(styles.col5)}> | ||
<PrimaryButton | ||
text={'Remove'} | ||
|
@@ -173,6 +188,7 @@ class UserCard extends Component { | |
} | ||
|
||
UserCard.propTypes = { | ||
isInvite: PropTypes.bool, | ||
user: PropTypes.object, | ||
updateProjectNember: PropTypes.func.isRequired, | ||
onRemoveClick: PropTypes.func.isRequired, | ||
|
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.
Consider checking if
checkManager
function is defined and imported correctly to ensure it works as expected.