Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

small tweaks

Steven Tey312676bdf5c7
diff --git a/components/app/modals/scim-modal.tsx b/components/app/modals/scim-modal.tsx
index d41c64513c..1463256a78 100644
--- a/components/app/modals/scim-modal.tsx
+++ b/components/app/modals/scim-modal.tsx
@@ -255,7 +255,7 @@ function SCIMModal({
className="mt-4"
text="Save changes"
loading={submitting}
- disabled={selectedProvider && selectedProvider === provider}
+ disabled={!currentProvider || currentProvider.scim === provider}
/>
</form>
</div>
diff --git a/pages/api/auth/[...nextauth].tsx b/pages/api/auth/[...nextauth].tsx
index 552bc2c26e..2d574bdc6d 100644
--- a/pages/api/auth/[...nextauth].tsx
+++ b/pages/api/auth/[...nextauth].tsx
@@ -200,8 +200,7 @@ export const authOptions: NextAuthOptions = {
let samlProfile;
if (account?.provider === "saml-idp") {
- // @ts-ignore
- // samlProfile = user?.profile;
+ // can't get project id from saml-idp so we return it for now
return true;
} else {
samlProfile = profile;
@@ -216,19 +215,31 @@ export const authOptions: NextAuthOptions = {
},
});
if (project) {
- await prisma.projectUsers.upsert({
- where: {
- userId_projectId: {
+ await Promise.allSettled([
+ // add user to project
+ prisma.projectUsers.upsert({
+ where: {
+ userId_projectId: {
+ projectId: project.id,
+ userId: user.id,
+ },
+ },
+ update: {},
+ create: {
projectId: project.id,
userId: user.id,
},
- },
- update: {},
- create: {
- projectId: project.id,
- userId: user.id,
- },
- });
+ }),
+ // delete any pending invites for this user
+ prisma.projectInvite.delete({
+ where: {
+ email_projectId: {
+ email: user.email,
+ projectId: project.id,
+ },
+ },
+ }),
+ ]);
}
}
return true;