Skip to content

Commit

Permalink
Fixes Incorrect http requests after sending an invite
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Oct 3, 2023
1 parent 5b6123a commit 6ec6ddf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions client/src/components/ErrorIndicator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import "./ErrorIndicator.scss";
import {ReactComponent as CriticalIcon} from "../icons/critical.svg";
import DOMPurify from "dompurify";

export default function ErrorIndicator({msg, standalone = false, decode = true}) {
const className = `error-indication ${standalone ? "standalone" : ""}`;
export default function ErrorIndicator({msg, standalone = false, decode = true, adjustMargin = false}) {
const className = `error-indication ${standalone ? "standalone" : ""} ${adjustMargin? "adjust-margin" : ""}`;
msg = msg.replaceAll("?", "");
return decode ? <span className={className}><CriticalIcon/>{msg}</span> :
<span className={className}>
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/ErrorIndicator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ span.error-indication {
margin-bottom: 15px;
}

&.adjust-margin {
margin-top: -15px;
}

span.error-message {
word-break: keep-all;
}
Expand Down
10 changes: 7 additions & 3 deletions client/src/pages/InvitationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const InvitationForm = () => {
const [guest, setGuest] = useState(false);
const [roles, setRoles] = useState([]);
const [selectedRoles, setSelectedRoles] = useState([]);
const [originalRoleId, setOriginalRoleId] = useState(-1);
const [originalRoleId, setOriginalRoleId] = useState(null);
const [invitation, setInvitation] = useState({
expiryDate: futureDate(30),
roleExpiryDate: futureDate(365),
Expand Down Expand Up @@ -196,6 +196,10 @@ export const InvitationForm = () => {
}}/>)
}
</div>}
{(!initial && isEmpty(selectedRoles)) &&
<ErrorIndicator msg={I18n.t("invitations.requiredRole")} adjustMargin={true}/>
}

<EmailField
name={I18n.t("invitations.invitees")}
addEmails={addEmails}
Expand Down Expand Up @@ -267,15 +271,15 @@ export const InvitationForm = () => {
value={invitation.enforceEmailEquality || false}
onChange={e => setInvitation({...invitation, enforceEmailEquality: e.target.checked})}
info={I18n.t("invitations.enforceEmailEquality")}
readOnly={selectedRoles.some(role => !role.overrideSettingsAllowed )}
readOnly={selectedRoles.some(role => !role.overrideSettingsAllowed)}
tooltip={I18n.t("tooltips.enforceEmailEqualityTooltip")}
/>

<Checkbox name={I18n.t("invitations.eduIDOnly")}
value={invitation.eduIDOnly || false}
onChange={e => setInvitation({...invitation, eduIDOnly: e.target.checked})}
info={I18n.t("invitations.eduIDOnly")}
readOnly={selectedRoles.some(role => !role.overrideSettingsAllowed )}
readOnly={selectedRoles.some(role => !role.overrideSettingsAllowed)}
tooltip={I18n.t("tooltips.eduIDOnlyTooltip")}
/>

Expand Down

0 comments on commit 6ec6ddf

Please sign in to comment.