mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
fix: Correctly check for local users' existence
This commit is contained in:
@@ -102,10 +102,6 @@ pub(super) async fn remote_user_in_rooms(&self, user_id: OwnedUserId) -> Result
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.services.users.exists(&user_id).await {
|
|
||||||
return Err!("Remote user does not exist in our database.",);
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut rooms: Vec<(OwnedRoomId, u64, String)> = self
|
let mut rooms: Vec<(OwnedRoomId, u64, String)> = self
|
||||||
.services
|
.services
|
||||||
.rooms
|
.rooms
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ impl crate::Service for Service {
|
|||||||
state: args.depend::<state::Service>("rooms::state"),
|
state: args.depend::<state::Service>("rooms::state"),
|
||||||
state_accessor: args.depend::<state_accessor::Service>("rooms::state_accessor"),
|
state_accessor: args.depend::<state_accessor::Service>("rooms::state_accessor"),
|
||||||
state_cache: args.depend::<state_cache::Service>("rooms::state_cache"),
|
state_cache: args.depend::<state_cache::Service>("rooms::state_cache"),
|
||||||
state_compressor: args.depend::<state_compressor::Service>("rooms::state_compressor"),
|
state_compressor: args
|
||||||
|
.depend::<state_compressor::Service>("rooms::state_compressor"),
|
||||||
timeline: args.depend::<timeline::Service>("rooms::timeline"),
|
timeline: args.depend::<timeline::Service>("rooms::timeline"),
|
||||||
users: args.depend::<users::Service>("users"),
|
users: args.depend::<users::Service>("users"),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -255,10 +255,12 @@ impl Service {
|
|||||||
|
|
||||||
pub async fn unlock_account(&self, user_id: &UserId) { self.db.userid_lock.remove(user_id); }
|
pub async fn unlock_account(&self, user_id: &UserId) { self.db.userid_lock.remove(user_id); }
|
||||||
|
|
||||||
/// Check if a user has an account on this homeserver.
|
/// Check if the provided user ID belongs to an existing (possibly
|
||||||
|
/// deactivated) account on this homeserver.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub async fn exists(&self, user_id: &UserId) -> bool {
|
pub async fn exists(&self, user_id: &UserId) -> bool {
|
||||||
self.db.userid_password.get(user_id).await.is_ok()
|
self.services.globals.user_is_local(&user_id)
|
||||||
|
&& self.db.userid_password.get(user_id).await.is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if account is deactivated
|
/// Check if account is deactivated
|
||||||
|
|||||||
Reference in New Issue
Block a user