use single global function for server name local and user local checking

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry
2024-04-28 11:35:25 -04:00
committed by June
parent 8f17d965b2
commit 9931e60050
14 changed files with 77 additions and 41 deletions

8
src/utils/user_id.rs Normal file
View File

@@ -0,0 +1,8 @@
//! utilities for doing things with UserId's / usernames
use ruma::UserId;
use crate::services;
/// checks if `user_id` is local to us via server_name comparison
pub(crate) fn user_is_local(user_id: &UserId) -> bool { user_id.server_name() == services().globals.config.server_name }