[PR #787] [MERGED] feat: optimize email filtering with frontend-only search #764

Closed
opened 2026-02-26 21:32:51 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787
Author: @dreamhunter2333
Created: 12/14/2025
Status: Merged
Merged: 12/14/2025
Merged by: @dreamhunter2333

Base: mainHead: feature/email


📝 Commits (2)

  • e957b37 feat: optimize email filtering with frontend-only search
  • cb90029 fix: restore Mail ID query input in Index.vue

📊 Changes

17 files changed (+489 additions, -546 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
db/2025-12-15-message-id-index.sql (+4 -0)
📝 db/schema.sql (+2 -0)
📝 frontend/package.json (+1 -1)
📝 frontend/pnpm-lock.yaml (+95 -87)
📝 frontend/src/components/MailBox.vue (+41 -8)
📝 frontend/src/views/Index.vue (+1 -1)
📝 frontend/src/views/admin/Mails.vue (+2 -8)
📝 frontend/src/views/user/UserMailBox.vue (+1 -7)
📝 vitepress-docs/docs/en/guide/feature/mail-api.md (+10 -8)
📝 vitepress-docs/docs/zh/guide/feature/mail-api.md (+10 -8)
📝 vitepress-docs/package.json (+1 -1)
📝 vitepress-docs/pnpm-lock.yaml (+26 -26)
📝 worker/package.json (+3 -3)
📝 worker/pnpm-lock.yaml (+284 -378)
📝 worker/src/admin_api/admin_mail_api.ts (+3 -5)
📝 worker/src/user_api/user_mail_api.ts (+3 -5)

📄 Description

User description

Summary

优化邮件过滤性能,将后端关键词搜索改为前端当前页过滤,并添加数据库索引。

Optimize email filtering performance by moving keyword search from backend to frontend (current page only) and adding database index.

Changes

Backend

  • ⚠️ BREAKING CHANGE: 移除 /admin/mails/user_api/mailskeyword 参数
  • ⚠️ BREAKING CHANGE: Removed keyword parameter from /admin/mails and /user_api/mails APIs

Frontend

  • 实现前端当前页邮件过滤(支持标题、内容搜索)
  • Implement frontend filtering for current page emails (search by subject, content)
  • 📱 支持桌面和移动端响应式布局
  • 📱 Support desktop and mobile responsive layouts

Database

  • 🗃️message_id 字段添加索引,优化更新操作性能
  • 🗃️ Add index on message_id field to optimize UPDATE performance
  • 📄 需要执行迁移文件:db/2025-12-15-message-id-index.sql
  • 📄 Migration required: db/2025-12-15-message-id-index.sql

Documentation

  • 📚 更新 API 文档(中英文)
  • 📚 Update API documentation (EN + ZH)
  • 📝 更新 CHANGELOG
  • 📝 Update CHANGELOG

Performance Impact

Before: Backend LIKE %keyword% query scanned 140k+ rows (unindexed raw TEXT field)

After: Frontend filter on 20-100 items in-memory

Result: ~1000x faster for typical use cases

Migration Guide

If you are using the mail APIs with keyword parameter:

  1. Remove keyword from API calls
  2. Use frontend filter input in the UI for content search
  3. Or filter by indexed fields like address, created_at

Database Migration

After merging, execute the migration SQL:

# Run in admin maintenance page or execute manually
cat db/2025-12-15-message-id-index.sql | sqlite3 your-database.db

Test Plan

  • Backend API returns correct results without keyword parameter
  • Frontend filtering works on desktop (inline input)
  • Frontend filtering works on mobile (separate row)
  • Filter supports Chinese and English text
  • Button alignment correct on both layouts
  • Documentation updated
  • CHANGELOG updated

🤖 Generated with Claude Code


PR Type

Enhancement, Documentation, Bug fix


Description

  • Implement frontend-only email filtering for current page.

  • Remove backend keyword filtering from mail APIs (breaking change).

  • Add database index on message_id to improve performance.

  • Update API documentation and dependencies.


Changes walkthrough 📝

Relevant files
Enhancement
4 files
MailBox.vue
Add frontend filtering for current page emails.                   
+41/-8   
Mails.vue
Remove backend keyword filtering in admin mail view.         
+2/-8     
UserMailBox.vue
Remove backend keyword filtering in user mail view.           
+1/-7     
Index.vue
Enable frontend filtering in main mailbox view.                   
+1/-9     
Bug fix
2 files
user_mail_api.ts
Remove keyword parameter from user mail API.                         
+3/-5     
admin_mail_api.ts
Remove keyword parameter from admin mail API.                       
+3/-5     
Dependencies
2 files
pnpm-lock.yaml
Update dependencies for worker project.                                   
+284/-378
pnpm-lock.yaml
Update dependencies for documentation project.                     
+26/-26 
Documentation
2 files
mail-api.md
Update English documentation for mail API changes.             
+10/-8   
mail-api.md
Update Chinese documentation for mail API changes.             
+10/-8   
Additional files
7 files
CHANGELOG.md +2/-0     
2025-12-15-message-id-index.sql +4/-0     
schema.sql +2/-0     
package.json +1/-1     
pnpm-lock.yaml +95/-87 
package.json +1/-1     
package.json +3/-3     

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.

  • 🔄 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/dreamhunter2333/cloudflare_temp_email/pull/787 **Author:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Created:** 12/14/2025 **Status:** ✅ Merged **Merged:** 12/14/2025 **Merged by:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Base:** `main` ← **Head:** `feature/email` --- ### 📝 Commits (2) - [`e957b37`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/e957b378ce21c6f4486d0106fbfc93c28c3892cf) feat: optimize email filtering with frontend-only search - [`cb90029`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/cb9002930de536333de9f7db6387c6b33bf4e677) fix: restore Mail ID query input in Index.vue ### 📊 Changes **17 files changed** (+489 additions, -546 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) ➕ `db/2025-12-15-message-id-index.sql` (+4 -0) 📝 `db/schema.sql` (+2 -0) 📝 `frontend/package.json` (+1 -1) 📝 `frontend/pnpm-lock.yaml` (+95 -87) 📝 `frontend/src/components/MailBox.vue` (+41 -8) 📝 `frontend/src/views/Index.vue` (+1 -1) 📝 `frontend/src/views/admin/Mails.vue` (+2 -8) 📝 `frontend/src/views/user/UserMailBox.vue` (+1 -7) 📝 `vitepress-docs/docs/en/guide/feature/mail-api.md` (+10 -8) 📝 `vitepress-docs/docs/zh/guide/feature/mail-api.md` (+10 -8) 📝 `vitepress-docs/package.json` (+1 -1) 📝 `vitepress-docs/pnpm-lock.yaml` (+26 -26) 📝 `worker/package.json` (+3 -3) 📝 `worker/pnpm-lock.yaml` (+284 -378) 📝 `worker/src/admin_api/admin_mail_api.ts` (+3 -5) 📝 `worker/src/user_api/user_mail_api.ts` (+3 -5) </details> ### 📄 Description ### **User description** ## Summary 优化邮件过滤性能,将后端关键词搜索改为前端当前页过滤,并添加数据库索引。 Optimize email filtering performance by moving keyword search from backend to frontend (current page only) and adding database index. ## Changes ### Backend - ⚠️ **BREAKING CHANGE**: 移除 `/admin/mails` 和 `/user_api/mails` 的 `keyword` 参数 - ⚠️ **BREAKING CHANGE**: Removed `keyword` parameter from `/admin/mails` and `/user_api/mails` APIs ### Frontend - ✨ 实现前端当前页邮件过滤(支持标题、内容搜索) - ✨ Implement frontend filtering for current page emails (search by subject, content) - 📱 支持桌面和移动端响应式布局 - 📱 Support desktop and mobile responsive layouts ### Database - 🗃️ 为 `message_id` 字段添加索引,优化更新操作性能 - 🗃️ Add index on `message_id` field to optimize UPDATE performance - 📄 需要执行迁移文件:`db/2025-12-15-message-id-index.sql` - 📄 Migration required: `db/2025-12-15-message-id-index.sql` ### Documentation - 📚 更新 API 文档(中英文) - 📚 Update API documentation (EN + ZH) - 📝 更新 CHANGELOG - 📝 Update CHANGELOG ## Performance Impact **Before**: Backend `LIKE %keyword%` query scanned 140k+ rows (unindexed `raw` TEXT field) **After**: Frontend filter on 20-100 items in-memory **Result**: ~1000x faster for typical use cases ⚡ ## Migration Guide If you are using the mail APIs with `keyword` parameter: 1. Remove `keyword` from API calls 2. Use frontend filter input in the UI for content search 3. Or filter by indexed fields like `address`, `created_at` ## Database Migration After merging, execute the migration SQL: ```bash # Run in admin maintenance page or execute manually cat db/2025-12-15-message-id-index.sql | sqlite3 your-database.db ``` ## Test Plan - [x] Backend API returns correct results without keyword parameter - [x] Frontend filtering works on desktop (inline input) - [x] Frontend filtering works on mobile (separate row) - [x] Filter supports Chinese and English text - [x] Button alignment correct on both layouts - [x] Documentation updated - [x] CHANGELOG updated 🤖 Generated with [Claude Code](https://claude.ai/code) ___ ### **PR Type** Enhancement, Documentation, Bug fix ___ ### **Description** - Implement frontend-only email filtering for current page. - Remove backend keyword filtering from mail APIs (breaking change). - Add database index on `message_id` to improve performance. - Update API documentation and dependencies. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>4 files</summary><table> <tr> <td><strong>MailBox.vue</strong><dd><code>Add frontend filtering for current page emails.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-ce7b47744c9011a27a8297d8e5095ccb9609a6849a9afe1a37e04ae47b2636f2">+41/-8</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>Mails.vue</strong><dd><code>Remove backend keyword filtering in admin mail view.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-b86fdeb5b4f6e16fe08d0d012a5cdcefae0d6face038b620e52e4a813a4356d1">+2/-8</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>UserMailBox.vue</strong><dd><code>Remove backend keyword filtering in user mail view.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-8d9a73f8df26d8b4aed6f8e7c9866408076dfbca119fa8341ad4fe1d0f6e0b1b">+1/-7</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>Index.vue</strong><dd><code>Enable frontend filtering in main mailbox view.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-9816bb6131d16919d3ca2c71fb0911d2cb73cc9a49d75394c6206ff15f1aa4d8">+1/-9</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Bug fix</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>user_mail_api.ts</strong><dd><code>Remove keyword parameter from user mail API.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-62bd76645c177bc3209db4dae9f73f3180c07bd0eb799b62a9afbeb2d3a73d41">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>admin_mail_api.ts</strong><dd><code>Remove keyword parameter from admin mail API.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-a38f1c7b95e309c677d6acb34bd783bda633c5d6626ed609362f035bd233da18">+3/-5</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Dependencies</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>pnpm-lock.yaml</strong><dd><code>Update dependencies for worker project.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-b40cf923090a5fb5f6cc0d6ce716c560645419d762871abb50383fdb423288c6">+284/-378</a></td> </tr> <tr> <td><strong>pnpm-lock.yaml</strong><dd><code>Update dependencies for documentation project.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-655c1410f6eacceaa9003212a9f840a660ace35e32e60d792be3640ec774af6f">+26/-26</a>&nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>mail-api.md</strong><dd><code>Update English documentation for mail API changes.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-4f99106a49786d7fe64cf221bc1665491c1bfbdad2524e50aa6c59f0a7b3bf57">+10/-8</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>mail-api.md</strong><dd><code>Update Chinese documentation for mail API changes.</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-6c591ac0d4b0ecd75a10ec850fbbd677d9d365fffa9aeddd1b3d9c63898c66bc">+10/-8</a>&nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Additional files</strong></td><td><details><summary>7 files</summary><table> <tr> <td><strong>CHANGELOG.md</strong></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed">+2/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>2025-12-15-message-id-index.sql</strong></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-41e7740ea986c300a9f92ced5fdaa779dff413b5e6fe1db6aec6b99e29b3a549">+4/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>schema.sql</strong></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-948c089a4de6325dd9a8f187fb0116272dedf46306023dce6d70b548e9f7539c">+2/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>package.json</strong></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-da6498268e99511d9ba0df3c13e439d10556a812881c9d03955b2ef7c6c1c655">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>pnpm-lock.yaml</strong></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-41b1ff3a74ba81fa74c8dd225d66d81573be3f2990e1d98b9b09798b147d40a8">+95/-87</a>&nbsp; </td> </tr> <tr> <td><strong>package.json</strong></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-3adbfbfaa65ecc60f48c8d009a52c697d4c80d61ee887799df22407fcb73f380">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>package.json</strong></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/787/files#diff-89dc6f41a53ce13f2da5a00dd34868762e6cd0df46eddc9f5c3c4510b1493870">+3/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
    kerem 2026-02-26 21:32:51 +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/cloudflare_temp_email#764
    No description provided.