From 000ffe6aaabb02d7cc6dbb96f19b192cb8b444f3 Mon Sep 17 00:00:00 2001
From: Paul Makles <paulmakles@gmail.com>
Date: Sun, 30 Aug 2020 13:40:29 +0100
Subject: [PATCH] Fix bug.

---
 src/notifications/ws.rs | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/notifications/ws.rs b/src/notifications/ws.rs
index ba37ec9..93e1916 100644
--- a/src/notifications/ws.rs
+++ b/src/notifications/ws.rs
@@ -47,13 +47,20 @@ impl Handler for Server {
                                         .to_string(),
                                     )?;
                                     
-                                    self.sender.send(
-                                        json!({
-                                            "type": "ready",
-                                            "data": user.create_payload()
-                                        })
-                                        .to_string(),
-                                    )
+                                    if let Ok(payload) = user.create_payload() {
+                                        self.sender.send(
+                                            json!({
+                                                "type": "ready",
+                                                "data": payload
+                                            })
+                                            .to_string(),
+                                        )
+                                    } else {
+                                        // ! TODO: FIXME: ALL THE NOTIFICATIONS CODE NEEDS TO BE
+                                        // ! RESTRUCTURED, IT IS UTTER GARBAGE. :)))))
+
+                                        Ok(())
+                                    }
                                 }
                                 StateResult::DatabaseError => self.sender.send(
                                     json!({
-- 
GitLab