mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 13:36:59 +00:00
Add january support.
This commit is contained in:
@@ -107,9 +107,11 @@ pub enum ClientboundNotification {
|
||||
}
|
||||
|
||||
impl ClientboundNotification {
|
||||
pub async fn publish(self, topic: String) -> Result<(), String> {
|
||||
prehandle_hook(&self); // ! TODO: this should be moved to pubsub
|
||||
hive_pubsub::backend::mongo::publish(get_hive(), &topic, self).await
|
||||
pub fn publish(self, topic: String) {
|
||||
async_std::task::spawn(async move {
|
||||
prehandle_hook(&self); // ! TODO: this should be moved to pubsub
|
||||
hive_pubsub::backend::mongo::publish(get_hive(), &topic, self).await.ok();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,9 +133,7 @@ async fn accept(stream: TcpStream) {
|
||||
id: id.clone(),
|
||||
online: true,
|
||||
}
|
||||
.publish(id)
|
||||
.await
|
||||
.ok();
|
||||
.publish(id);
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
@@ -173,9 +171,7 @@ async fn accept(stream: TcpStream) {
|
||||
id: channel.clone(),
|
||||
user,
|
||||
}
|
||||
.publish(channel)
|
||||
.await
|
||||
.ok();
|
||||
.publish(channel);
|
||||
} else {
|
||||
send(ClientboundNotification::Error(
|
||||
WebSocketError::AlreadyAuthenticated,
|
||||
@@ -196,9 +192,7 @@ async fn accept(stream: TcpStream) {
|
||||
id: channel.clone(),
|
||||
user,
|
||||
}
|
||||
.publish(channel)
|
||||
.await
|
||||
.ok();
|
||||
.publish(channel);
|
||||
} else {
|
||||
send(ClientboundNotification::Error(
|
||||
WebSocketError::AlreadyAuthenticated,
|
||||
@@ -238,9 +232,7 @@ async fn accept(stream: TcpStream) {
|
||||
id: id.clone(),
|
||||
online: false,
|
||||
}
|
||||
.publish(id)
|
||||
.await
|
||||
.ok();
|
||||
.publish(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user