a
This commit is contained in:
@@ -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};
|
||||||
|
|
||||||
|
|||||||
@@ -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},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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(())
|
||||||
|
|||||||
Reference in New Issue
Block a user