You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/09/25 18:52:46 UTC
[incubator-ponymail-foal] 02/04: Add a full delete if told to.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 56b15709cdec22fead59e16541d21f6d6fe18273
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sat Sep 25 13:51:16 2021 -0500
Add a full delete if told to.
---
server/endpoints/mgmt.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/server/endpoints/mgmt.py b/server/endpoints/mgmt.py
index 68bed57..af031f7 100644
--- a/server/endpoints/mgmt.py
+++ b/server/endpoints/mgmt.py
@@ -57,9 +57,17 @@ async def process(
email = await plugins.messages.get_email(session, permalink=doc)
if email and isinstance(email, dict) and plugins.aaa.can_access_email(session, email):
email["deleted"] = True
- await session.database.index(
- index=session.database.dbs.mbox, body=email, id=email["id"],
- )
+ if server.config.ui.fully_delete and email["id"] and email["dbid"]: # Full on GDPR blast?
+ await session.database.delete(
+ index=session.database.dbs.mbox, id=email["id"],
+ )
+ await session.database.delete(
+ index=session.database.dbs.source, id=email["dbid"],
+ )
+ else: # Standard behavior: hide the email from everyone.
+ await session.database.index(
+ index=session.database.dbs.mbox, body=email, id=email["id"],
+ )
lid = email.get("list_raw", "??")
await plugins.auditlog.add_entry(session, action="delete", target=doc, lid=lid, log=f"Removed email {doc} from {lid} archives")
delcount += 1