[PR #2410] [MERGED] fix: exclude soft-deleted documents from folder count #2281

Closed
opened 2026-02-26 20:33:13 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/2410
Author: @misha366
Created: 1/25/2026
Status: Merged
Merged: 1/28/2026
Merged by: @dguyen

Base: mainHead: fix/doc-2398-folder-count-includes-deleted


📝 Commits (1)

  • 513ab14 fix: exclude soft-deleted documents from folder count

📊 Changes

1 file changed (+2 additions, -0 deletions)

View changed files

📝 packages/lib/server-only/folder/find-folders-internal.ts (+2 -0)

📄 Description

Description

Fixed folder document count incorrectly including soft-deleted documents. When a completed document was deleted (soft-delete), it remained in the folder count because the query didn't filter by deletedAt.

Fixes #2398

Changes Made

  • Added deletedAt: null filter to the document count query in find-folders-internal.ts
  • Added deletedAt: null filter to the template count query in find-folders-internal.ts

Testing Performed

  • Reproduced the bug locally:
    1. Created a folder
    2. Added a completed document to the folder
    3. Deleted the document (soft-delete)
    4. Observed folder showing incorrect count (1 document instead of 0)
  • Verified the fix works - folder now shows 0 documents after deletion

Checklist

  • [+] I have tested these changes locally and they work as expected.
  • I have added/updated tests that prove the effectiveness of these changes.
  • I have updated the documentation to reflect these changes, if applicable.
  • [+] I have followed the project's coding style guidelines.
  • I have addressed the code review feedback from the previous submission, if applicable.

Additional Notes

The same pattern (deletedAt: null) is already used in other query functions like find-documents.ts and search-documents-with-keyword.ts


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/2410 **Author:** [@misha366](https://github.com/misha366) **Created:** 1/25/2026 **Status:** ✅ Merged **Merged:** 1/28/2026 **Merged by:** [@dguyen](https://github.com/dguyen) **Base:** `main` ← **Head:** `fix/doc-2398-folder-count-includes-deleted` --- ### 📝 Commits (1) - [`513ab14`](https://github.com/documenso/documenso/commit/513ab148aa70c994ba469364fa23c9ae54c3b8dd) fix: exclude soft-deleted documents from folder count ### 📊 Changes **1 file changed** (+2 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/lib/server-only/folder/find-folders-internal.ts` (+2 -0) </details> ### 📄 Description ## Description Fixed folder document count incorrectly including soft-deleted documents. When a completed document was deleted (soft-delete), it remained in the folder count because the query didn't filter by `deletedAt`. ## Related Issue Fixes #2398 ## Changes Made - Added `deletedAt: null` filter to the document count query in `find-folders-internal.ts` - Added `deletedAt: null` filter to the template count query in `find-folders-internal.ts` ## Testing Performed - Reproduced the bug locally: 1. Created a folder 2. Added a completed document to the folder 3. Deleted the document (soft-delete) 4. Observed folder showing incorrect count (1 document instead of 0) - Verified the fix works - folder now shows 0 documents after deletion ## Checklist - [+] I have tested these changes locally and they work as expected. - [ ] I have added/updated tests that prove the effectiveness of these changes. - [ ] I have updated the documentation to reflect these changes, if applicable. - [+] I have followed the project's coding style guidelines. - [ ] I have addressed the code review feedback from the previous submission, if applicable. ## Additional Notes The same pattern (`deletedAt: null`) is already used in other query functions like `find-documents.ts` and `search-documents-with-keyword.ts` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 20:33:13 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#2281
No description provided.