summary refs log tree commit diff
path: root/db.py
diff options
context:
space:
mode:
authormeltland <[email protected]>2025-03-28 14:11:46 -0400
committermeltland <[email protected]>2025-03-28 14:11:46 -0400
commitcd1945e802cc589e7543f4e88096e8dfcab3721b (patch)
tree61033d3ea9760b3fcd7559c2abcd4cced31ba34e /db.py
parentebc7ef7f70e1eda6cab3dca24cf7e2c3cb4d3246 (diff)
account deletion
Diffstat (limited to 'db.py')
-rw-r--r--db.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/db.py b/db.py
index 46bad8d..1056e5e 100644
--- a/db.py
+++ b/db.py
@@ -69,6 +69,15 @@ class acc:
             return "notExists"
         try:
             usersd.delete_one({"username": username})
+            postsd.delete_many({"author": username})
+            postsd.update_many(
+                {"replies": {"$elemMatch": {"author": username}}},
+                {"$set": {"replies.$.content": "post deleted"}}
+            )
+            postsd.update_many(
+                {"replies": {"$elemMatch": {"author": username}}},
+                {"$set": {"replies.$.author": "deleted"}}
+            )
         except:
             return "fail"
         return True
@@ -169,6 +178,10 @@ class posts:
                 {"replies": {"$elemMatch": {"_id": post_id}}},
                 {"$set": {"replies.$.content": "post deleted"}}
             )
+            postsd.update_many(
+                {"replies": {"$elemMatch": {"_id": post_id}}},
+                {"$set": {"replies.$.author": "deleted"}}
+            )
         except:
             return "fail"
         return True