From 714444d1d65edde9bfe8e7e2684021bb6ff84120 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Wed, 1 May 2024 10:14:36 -0600 Subject: [PATCH] fix(#10): slugify the appName and remove weird characters --- .../settings/github/github-setup.tsx | 25 ++++++++++++++----- .../settings/github/remove-github-app.tsx | 1 + 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/components/dashboard/settings/github/github-setup.tsx b/components/dashboard/settings/github/github-setup.tsx index 997dbe44..6e9a8058 100644 --- a/components/dashboard/settings/github/github-setup.tsx +++ b/components/dashboard/settings/github/github-setup.tsx @@ -31,6 +31,14 @@ export const generateName = () => { n2[Math.round(Math.random() * (n2.length - 1))] }`; }; +function slugify(text: string) { + return text + .toLowerCase() + .replace(/[\s\^&*()+=!]+/g, "-") + .replace(/[\$.,*+~()'"!:@^&]+/g, "") + .replace(/-+/g, "-") + .replace(/^-+|-+$/g, ""); +} export const GithubSetup = () => { const [isOrganization, setIsOrganization] = useState(false); @@ -98,12 +106,17 @@ export const GithubSetup = () => { your GitHub account. - - Install Github App - +
+ + Install Github App + + +
) : (
diff --git a/components/dashboard/settings/github/remove-github-app.tsx b/components/dashboard/settings/github/remove-github-app.tsx index e45d4265..ec1aa538 100644 --- a/components/dashboard/settings/github/remove-github-app.tsx +++ b/components/dashboard/settings/github/remove-github-app.tsx @@ -39,6 +39,7 @@ export const RemoveGithubApp = () => { await mutateAsync() .then(async () => { await refetch(); + utils.admin.one.invalidate(); await utils.admin.haveGithubConfigured.invalidate(); toast.success("Github application deleted succesfully."); })