summary refs log tree commit diff
path: root/db.py
diff options
context:
space:
mode:
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