diff --git a/src/database/entities/user.rs b/src/database/entities/user.rs index c4d199d284d497f0240769bbf69c8293c0662d51..7c2a68b4149812be40fe1333c4871155114fa6a6 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 672701b9c459608325da56d6dbe646bf4f201bce..da58526e1e3b6b1df8eb64f4e098402f37a62cab 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 {