diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7aa1586..1a4d1bb 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -63,7 +63,7 @@ jobs: - name: "Deploy to Firebase" uses: w9jds/firebase-action@master with: - args: deploy --only functions + args: deploy --only functions,firestore --force env: GCP_SA_KEY: ${{ secrets.F_PRIVATE_KEY }} PROJECT_ID: ${{ vars.F_PROJECT_ID }} diff --git a/functions-scrapper/.npmrc b/functions-scrapper/.npmrc new file mode 100644 index 0000000..e9ee3cb --- /dev/null +++ b/functions-scrapper/.npmrc @@ -0,0 +1 @@ +legacy-peer-deps=true \ No newline at end of file diff --git a/functions/.npmrc b/functions/.npmrc new file mode 100644 index 0000000..e9ee3cb --- /dev/null +++ b/functions/.npmrc @@ -0,0 +1 @@ +legacy-peer-deps=true \ No newline at end of file diff --git a/server/api/instance/notes/index.post.ts b/server/api/instance/notes/index.post.ts index 519864f..233d475 100644 --- a/server/api/instance/notes/index.post.ts +++ b/server/api/instance/notes/index.post.ts @@ -71,15 +71,14 @@ export default defineConditionallyCachedEventHandler(async (event) => { // Public notes only query = query.where("public", "==", true); + // Linked notes can only be public if (linkedNoteSlug) { // Same as /api/instance/notes/[noteSlug].post - const notesSnapshot = await firebaseFirestore - .collectionGroup("notes") - .where("instanceRef", "==", currentInstanceRef) + const linkedNotesSnapshot = await query .where("slug", "==", linkedNoteSlug) .limit(1) .get(); - const [snapshot] = notesSnapshot.docs; + const [snapshot] = linkedNotesSnapshot.docs; // Check if linked note exists if (!snapshot?.exists) {