From fe821b82836d045a8fb48cc15671013eda996d5e Mon Sep 17 00:00:00 2001
From: Paul <paulmakles@gmail.com>
Date: Thu, 8 Jul 2021 22:54:46 +0100
Subject: [PATCH] Temporary fix for compile. Add badge ID.

---
 src/database/entities/user.rs        |  1 +
 src/routes/channels/message_query.rs | 31 ++++++++++++++++++----------
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/src/database/entities/user.rs b/src/database/entities/user.rs
index c4d199d..7c2a68b 100644
--- a/src/database/entities/user.rs
+++ b/src/database/entities/user.rs
@@ -67,6 +67,7 @@ pub enum Badges {
     Translator = 2,
     Supporter = 4,
     ResponsibleDisclosure = 8,
+    RevoltTeam = 16,
     EarlyAdopter = 256,
 }
 
diff --git a/src/routes/channels/message_query.rs b/src/routes/channels/message_query.rs
index 672701b..da58526 100644
--- a/src/routes/channels/message_query.rs
+++ b/src/routes/channels/message_query.rs
@@ -59,7 +59,7 @@ pub async fn req(user: User, target: Ref, options: Form<Options>) -> Result<Json
     let limit = options.limit.unwrap_or(50);
     let channel = target.id();
     if let Some(nearby) = &options.nearby {
-        let cursors = try_join!(
+        let mut cursors = try_join!(
             collection.find(
                 doc! {
                     "channel": channel,
@@ -94,16 +94,25 @@ pub async fn req(user: User, target: Ref, options: Form<Options>) -> Result<Json
             with: "messages",
         })?;
 
-        for mut cursor in [ cursors.0, cursors.1 ] {
-            while let Some(result) = cursor.next().await {
-                if let Ok(doc) = result {
-                    messages.push(
-                        from_document::<Message>(doc).map_err(|_| Error::DatabaseError {
-                            operation: "from_document",
-                            with: "message",
-                        })?,
-                    );
-                }
+        while let Some(result) = cursors.0.next().await {
+            if let Ok(doc) = result {
+                messages.push(
+                    from_document::<Message>(doc).map_err(|_| Error::DatabaseError {
+                        operation: "from_document",
+                        with: "message",
+                    })?,
+                );
+            }
+        }
+
+        while let Some(result) = cursors.1.next().await {
+            if let Ok(doc) = result {
+                messages.push(
+                    from_document::<Message>(doc).map_err(|_| Error::DatabaseError {
+                        operation: "from_document",
+                        with: "message",
+                    })?,
+                );
             }
         }
     } else {
-- 
GitLab