Skip to content

Commit

Permalink
warning for invites
Browse files Browse the repository at this point in the history
  • Loading branch information
alesanchezr committed Apr 11, 2023
1 parent 6a67828 commit 34442b4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app/components/ConfirmAlert.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import PropTypes from 'prop-types';
const emptyCallback = () => {};
const defaultProps = {
onOpen: emptyCallback,
onClose: emptyCallback,
onClose: null,
isOpen: false,
setIsOpen: emptyCallback,
cancelText: 'Cancel',
Expand Down Expand Up @@ -46,7 +46,7 @@ const ConfirmAlert = ({
<Dialog
open={isOpen}
onClose={() => {
onClose();
onClose && onClose();
setIsOpen(false);
}}
aria-labelledby={titleTestId}
Expand All @@ -63,7 +63,7 @@ const ConfirmAlert = ({
</DialogContent>
) : <></>}
<DialogActions>
<Button
{onClose && <Button
data-cy={cancelButtonTestId}
onClick={() => {
onClose();
Expand All @@ -72,7 +72,7 @@ const ConfirmAlert = ({
color="primary"
>
{cancelText}
</Button>
</Button>}
<Button
color="primary"
type="submit"
Expand Down
12 changes: 12 additions & 0 deletions src/app/views/admin/github-form/OrganizationUsers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import AddCircleOutlineIcon from '@material-ui/icons/AddCircleOutline';
import DeleteOutlineRounded from '@material-ui/icons/DeleteOutlineRounded';
import AlarmOffRounded from '@material-ui/icons/AlarmOffRounded';
import { SmartMUIDataTable } from '../../../components/SmartDataTable';
import ConfirmAlert from '../../../components/ConfirmAlert';
import BulkAction from "./BulkAction"
import bc from '../../../services/breathecode';
import dayjs from 'dayjs';
Expand Down Expand Up @@ -58,6 +59,7 @@ const getStatus = (u) => {
const OrganizationUsers = ({ organization }) => {
const [items, setItems] = useState([]);
const [ userToAdd, setUserToAdd] = useState(false);
const [ confirm, setConfirm] = useState(false);

const columns = [
{
Expand Down Expand Up @@ -110,12 +112,22 @@ const OrganizationUsers = ({ organization }) => {
if(!cu) return false;

const result = await bc.auth().addGithubUser({ cohort: cu.cohort.id, user: cu.user.id });
console.log("rrrresult", result);
if(result.status == 200){
setConfirm(true);
}
setUserToAdd(false);
loadData();
}

return (
<Grid item md={12} className="mt-2">
<ConfirmAlert
title={`User has been added to the invite queue. Keep in mind that invites are not sent in real time, instead, they are sent at 2AM UTC. Make sure the student has connected its GitHub account by then.`}
isOpen={confirm}
cancelText="I understand invites are processed later in batch"
onOpen={() => setConfirm(false)}
/>
{ userToAdd == true && <PickCohortUserModal
cohortQuery={{ stage: 'STARTED,PREWORK' }}
cohortUserQuery={{ educational_status:'ACTIVE' }}
Expand Down

1 comment on commit 34442b4

@vercel
Copy link

@vercel vercel bot commented on 34442b4 Apr 11, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.