summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--db.py9
-rw-r--r--main.py7
2 files changed, 16 insertions, 0 deletions
diff --git a/db.py b/db.py
index bcbf9e2..28f3ba8 100644
--- a/db.py
+++ b/db.py
@@ -33,6 +33,15 @@ class acc:
             return "notExists"
         else:
             return user
+    
+    def get_author(username):
+        user = usersd.find_one({"username": username})
+        if not user:
+            return "notExists"
+        else:
+            del user["secure"]
+            del user["profile"]
+            return user
 
     def add(data, username=None):
         user = usersd.find_one({"username": username})
diff --git a/main.py b/main.py
index 9dd1db4..b9e000f 100644
--- a/main.py
+++ b/main.py
@@ -464,6 +464,13 @@ async def handler(websocket):
                     await websocket.send(util.error(fc, listener))

                     continue

                 data["author"] = author

+                incr = -1

+                for j in data["replies"]:

+                    incr += 1

+                    data = acc.get_author(j["author"])

+                    if type(data) != dict:

+                        data = {}

+                data["replies"][incr]["author"] = data

                 broadcast(clients, json.dumps({

                     "command": "new_post",

                     "data": data