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

View file

@ -20,7 +20,11 @@ use serde_json::json;
use tracing::debug;
use super::SESSION_ID_LENGTH;
use crate::{services, utils, Error, Result, Ruma};
use crate::{
services,
utils::{self, user_id::user_is_local},
Error, Result, Ruma,
};
/// # `POST /_matrix/client/r0/keys/upload`
///
@ -260,7 +264,7 @@ pub(crate) async fn get_keys_helper<F: Fn(&UserId) -> bool>(
for (user_id, device_ids) in device_keys_input {
let user_id: &UserId = user_id;
if user_id.server_name() != services().globals.server_name() {
if !user_is_local(user_id) {
get_over_federation
.entry(user_id.server_name())
.or_insert_with(Vec::new)