1
0
This commit is contained in:
2024-05-21 07:09:06 +03:00
parent ff1e29939b
commit 857c6d62bd
4 changed files with 10 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
use std::collections::{HashMap, HashSet}; use std::collections::HashMap;
use chrono::{DateTime, Duration}; use chrono::Duration;
use crate::{config, entity, state, web::ws}; use crate::{config, entity, state, web::ws};

View File

@@ -4,7 +4,7 @@ use axum::{
}; };
use crate::{ use crate::{
entity::{LongId, ShortId}, entity::LongId,
state::AppState, state::AppState,
web::{self, ws}, web::{self, ws},
}; };

View File

@@ -5,7 +5,7 @@ use axum::{
}; };
use crate::{ use crate::{
entity::{LongId, ShortId}, entity::ShortId,
state::AppState, state::AppState,
web::{self, ws}, web::{self, ws},
}; };

View File

@@ -49,13 +49,9 @@ pub async fn follow_user(
state.database.follow_user(context.user.id, user_id).await?; state.database.follow_user(context.user.id, user_id).await?;
ws::broadcast_message( ws::broadcast_message(ws::Message::FollowUser { user_id }, &state, |key| {
ws::Message::FollowUser { key.user_id == context.user.id
user_id, })
},
&state,
|key| key.user_id == context.user.id,
)
.await; .await;
Ok(()) Ok(())
@@ -87,13 +83,9 @@ pub async fn unfollow_user(
.unfollow_user(context.user.id, user_id) .unfollow_user(context.user.id, user_id)
.await?; .await?;
ws::broadcast_message( ws::broadcast_message(ws::Message::UnfollowUser { user_id }, &state, |key| {
ws::Message::UnfollowUser { key.user_id == context.user.id
user_id, })
},
&state,
|key| key.user_id == context.user.id,
)
.await; .await;
Ok(()) Ok(())