feat: implement message deletion functionality and improve draft handling

- Added `MoveToTrash` method in `WebmailRepository` to move messages to the Trash folder instead of deleting them permanently.
- Introduced `handleDelete` method in `mailAPI` to handle message deletion requests from the client.
- Updated router to include a new route for message deletion.
- Enhanced the compose page to manage draft integrity, ensuring drafts are correctly associated with sent messages.
- Implemented UI changes to allow users to delete messages from the mail folder view.
- Added tests to verify the correct behavior of message deletion and draft handling.
- Updated database migration scripts to reconcile folder counters and ensure accurate unread counts.
- Added tests for TLS-RPT report parsing and webmail repository functionalities.
This commit is contained in:
Lucas Rayan committed 2026-08-20 15:32:14 -03:00
1 parent 4f1b9c5217
commit 880dced9e4
20 files changed
+1053 -30

No files matched your search

@@ -0,0 +1,34 @@
import { describe, it, expect } from "vitest";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
/**
* The well-known documents senders fetch over HTTPS.
*
* The protocols service serves /.well-known/mta-sts.txt, but the hostname a
* sender asks - mta-sts.<domain> - lands on this Next app, which had no route
* for it and answered its own 404 page. The DNS half of MTA-STS was published
* and the HTTPS half was not, so every sender saw "no-policy-found" and no
* TLS policy was ever enforced. Google's daily TLS-RPT report says exactly
* that.
*/
const config = readFileSync(resolve(process.cwd(), "next.config.ts"), "utf8");
describe("the MTA-STS policy senders fetch", () => {
it("is routed to the service that serves it", () => {
expect(config).toContain("/.well-known/mta-sts.txt");
expect(config).toMatch(/mta-sts\.txt[\s\S]{0,200}PROTOCOLS_SERVICE_URL/);
});
it("routes the other well-known documents the same way", () => {
expect(config).toContain("/.well-known/security.txt");
});
// A rewrite, not a redirect: RFC 8461 section 3.3 requires the policy to be
// fetched over HTTPS from that exact path, and a sender is not obliged to
// follow a redirect to get it.
it("rewrites rather than redirects", () => {
expect(config).not.toMatch(/redirects\(\)/);
});
});