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.

fix bitly importer

Steven Tey317d1318adcc
diff --git a/apps/web/app/api/workspaces/[idOrSlug]/import/bitly/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/import/bitly/route.ts
index 85074ace6c..19e1cd632f 100644
--- a/apps/web/app/api/workspaces/[idOrSlug]/import/bitly/route.ts
+++ b/apps/web/app/api/workspaces/[idOrSlug]/import/bitly/route.ts
@@ -57,6 +57,7 @@ export const POST = withWorkspace(async ({ req, workspace, session }) => {
const doaminsNotInWorkspace = selectedDomains.filter(
({ domain }) => !workspace.domains?.find((d) => d.slug === domain),
);
+
if (doaminsNotInWorkspace.length > 0) {
await Promise.allSettled([
prisma.domain.createMany({
@@ -69,7 +70,7 @@ export const POST = withWorkspace(async ({ req, workspace, session }) => {
})),
skipDuplicates: true,
}),
- doaminsNotInWorkspace.map(({ slug }) => addDomainToVercel(slug)),
+ doaminsNotInWorkspace.map(({ domain }) => addDomainToVercel(domain)),
]);
}
diff --git a/apps/web/ui/modals/import-bitly-modal.tsx b/apps/web/ui/modals/import-bitly-modal.tsx
index 55057d5eb8..0dbf516cc9 100644
--- a/apps/web/ui/modals/import-bitly-modal.tsx
+++ b/apps/web/ui/modals/import-bitly-modal.tsx
@@ -190,23 +190,25 @@ function ImportBitlyModal({
/>
</div>
))}
- <div className="flex items-center justify-between space-x-2 rounded-md py-1 pl-2 pr-4">
- <p className="text-xs text-gray-500">
- {tags.length} tags found. Import all?
- </p>
- <Switch
- fn={() => {
- if (selectedGroupTags.includes(guid)) {
- setSelectedGroupTags((prev) =>
- prev.filter((g) => g !== guid),
- );
- } else {
- setSelectedGroupTags((prev) => [...prev, guid]);
- }
- }}
- checked={selectedGroupTags.includes(guid)}
- />
- </div>
+ {tags.length > 0 && (
+ <div className="flex items-center justify-between space-x-2 rounded-md py-1 pl-2 pr-4">
+ <p className="text-xs text-gray-500">
+ {tags.length} tags found. Import all?
+ </p>
+ <Switch
+ fn={() => {
+ if (selectedGroupTags.includes(guid)) {
+ setSelectedGroupTags((prev) =>
+ prev.filter((g) => g !== guid),
+ );
+ } else {
+ setSelectedGroupTags((prev) => [...prev, guid]);
+ }
+ }}
+ checked={selectedGroupTags.includes(guid)}
+ />
+ </div>
+ )}
</div>
))
) : (