From 57a9795814e61c2df1e270a5c1aef45e5ec0868f Mon Sep 17 00:00:00 2001
From: duckduckgrayduck <102841251+duckduckgrayduck@users.noreply.github.com>
Date: Thu, 25 Jul 2024 08:57:09 -0500
Subject: [PATCH] Generate airtable URL using a function
---
src/pages/app/Documents.svelte | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/pages/app/Documents.svelte b/src/pages/app/Documents.svelte
index 612ce0be2..4bebc00d1 100644
--- a/src/pages/app/Documents.svelte
+++ b/src/pages/app/Documents.svelte
@@ -52,6 +52,17 @@
let preUploadFiles = [];
let anonymousClosed = false;
+ function constructPrefillUrl() {
+ const baseUrl = "https://airtable.com/app93Yt5cwdVWTnqn/pagogIhgB1jZTzq00/form";
+ const email = encodeURIComponent(orgsAndUsers.me.email);
+ const username = encodeURIComponent(orgsAndUsers.me.username);
+ const accountUrl = `https://accounts.muckrock.com/users/${username}/`;
+ const orgSlug = encodeURIComponent(orgsAndUsers.me.organization.slug);
+ const orgAccountUrl = `https://accounts.muckrock.com/organizations/${orgSlug}`;
+
+ return `${baseUrl}?prefill_MR+User+Email=${email}&prefill_MR+User+Name=${username}&prefill_MR+User+Account+URL=${accountUrl}&prefill_MR+Organization+Name=${orgSlug}&prefill_MR+Organization+Account+URL=${orgAccountUrl}`;
+ }
+
function showUploadModal({ detail: files }) {
if (files != null) {
preUploadFiles = Array.from(files);
@@ -181,7 +192,7 @@
>
{/if}
{#if $orgsAndUsers.loggedIn && !$orgsAndUsers.isVerified}
-
+
{/if}