Skip to content

Commit

Permalink
Fixes #36775 - Allow creation of unlimited PATs again
Browse files Browse the repository at this point in the history
Before this patch, the expires_at field was set to a single space, which
the backend considered invalid. With this patch, the value is null for
unlimited PATs, which the backend accepts.
  • Loading branch information
adamruzicka authored and MariaAga committed Oct 6, 2023
1 parent 001a7ff commit cf9236e
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,20 @@ const PersonalAccessTokenModal = ({ controller, url }) => {
return true;
};

const formatExpiration = () => {
if (endsNever) {
return null;
}
return `${date} ${time}`;
};

const handleSubmit = () => {
if (isDateTimeInFuture() && isDateValid && isTimeValid) {
dispatch(
APIActions.post({
key: PERSONAL_ACCESS_TOKEN_FORM_SUBMITTED,
url,
params: { name, expires_at: `${date} ${time}`, controller },
params: { name, expires_at: formatExpiration(), controller },
handleSuccess: ({ data }) => {
closeModal();
dispatch({
Expand Down

0 comments on commit cf9236e

Please sign in to comment.