From 857c6d62bd58a39d4b2ab56266443f307ccc4fa8 Mon Sep 17 00:00:00 2001 From: lionarius Date: Tue, 21 May 2024 07:09:06 +0300 Subject: [PATCH] a --- src/notifier/mod.rs | 4 ++-- src/web/routes/notification.rs | 2 +- src/web/routes/secret/mod.rs | 2 +- src/web/routes/user/follow.rs | 20 ++++++-------------- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/notifier/mod.rs b/src/notifier/mod.rs index 441918c..ddbe831 100644 --- a/src/notifier/mod.rs +++ b/src/notifier/mod.rs @@ -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}; diff --git a/src/web/routes/notification.rs b/src/web/routes/notification.rs index 57da433..eab4337 100644 --- a/src/web/routes/notification.rs +++ b/src/web/routes/notification.rs @@ -4,7 +4,7 @@ use axum::{ }; use crate::{ - entity::{LongId, ShortId}, + entity::LongId, state::AppState, web::{self, ws}, }; diff --git a/src/web/routes/secret/mod.rs b/src/web/routes/secret/mod.rs index 302ed73..b91048d 100644 --- a/src/web/routes/secret/mod.rs +++ b/src/web/routes/secret/mod.rs @@ -5,7 +5,7 @@ use axum::{ }; use crate::{ - entity::{LongId, ShortId}, + entity::ShortId, state::AppState, web::{self, ws}, }; diff --git a/src/web/routes/user/follow.rs b/src/web/routes/user/follow.rs index b3f1b69..55388ba 100644 --- a/src/web/routes/user/follow.rs +++ b/src/web/routes/user/follow.rs @@ -49,13 +49,9 @@ pub async fn follow_user( state.database.follow_user(context.user.id, user_id).await?; - ws::broadcast_message( - ws::Message::FollowUser { - user_id, - }, - &state, - |key| key.user_id == context.user.id, - ) + ws::broadcast_message(ws::Message::FollowUser { user_id }, &state, |key| { + key.user_id == context.user.id + }) .await; Ok(()) @@ -87,13 +83,9 @@ pub async fn unfollow_user( .unfollow_user(context.user.id, user_id) .await?; - ws::broadcast_message( - ws::Message::UnfollowUser { - user_id, - }, - &state, - |key| key.user_id == context.user.id, - ) + ws::broadcast_message(ws::Message::UnfollowUser { user_id }, &state, |key| { + key.user_id == context.user.id + }) .await; Ok(())