forked from jmug/stoatchat
Get notifications working properly.
This commit is contained in:
17
src/notifications/subscriptions.rs
Normal file
17
src/notifications/subscriptions.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use crate::database::entities::User;
|
||||
|
||||
use super::hive::get_hive;
|
||||
use hive_pubsub::PubSub;
|
||||
|
||||
pub async fn generate_subscriptions(user: &User) -> Result<(), String> {
|
||||
let hive = get_hive();
|
||||
hive.subscribe(user.id.clone(), user.id.clone())?;
|
||||
|
||||
if let Some(relations) = &user.relations {
|
||||
for relation in relations {
|
||||
hive.subscribe(user.id.clone(), relation.id.clone())?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user