fix invalid database code for servers_invite_via
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
59ba3e3190
commit
878dcd71bb
2 changed files with 10 additions and 4 deletions
|
@ -1597,6 +1597,8 @@ async fn remote_leave_room(user_id: &UserId, room_id: &RoomId) -> Result<()> {
|
||||||
HashSet::from_iter,
|
HashSet::from_iter,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
debug!("servers in remote_leave_room: {servers:?}");
|
||||||
|
|
||||||
for remote_server in servers {
|
for remote_server in servers {
|
||||||
let make_leave_response = services()
|
let make_leave_response = services()
|
||||||
.sending
|
.sending
|
||||||
|
|
|
@ -6,6 +6,7 @@ use ruma::{
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
OwnedRoomId, OwnedServerName, OwnedUserId, RoomId, ServerName, UserId,
|
OwnedRoomId, OwnedServerName, OwnedUserId, RoomId, ServerName, UserId,
|
||||||
};
|
};
|
||||||
|
use tracing::error;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
database::KeyValueDatabase,
|
database::KeyValueDatabase,
|
||||||
|
@ -589,13 +590,16 @@ impl service::rooms::state_cache::Data for KeyValueDatabase {
|
||||||
|
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self))]
|
||||||
fn servers_invite_via(&self, room_id: &RoomId) -> Result<Option<Vec<OwnedServerName>>> {
|
fn servers_invite_via(&self, room_id: &RoomId) -> Result<Option<Vec<OwnedServerName>>> {
|
||||||
let room_id = room_id.as_bytes().to_vec();
|
let mut key = room_id.as_bytes().to_vec();
|
||||||
|
key.push(0xFF);
|
||||||
|
|
||||||
self.roomid_inviteviaservers
|
self.roomid_inviteviaservers
|
||||||
.get(&room_id)?
|
.get(&key)?
|
||||||
.map(|servers| {
|
.map(|servers| {
|
||||||
let state = serde_json::from_slice(&servers)
|
let state = serde_json::from_slice(&servers).map_err(|e| {
|
||||||
.map_err(|_| Error::bad_database("Invalid state in userroomid_leftstate."))?;
|
error!("Invalid state in userroomid_leftstate: {e}");
|
||||||
|
Error::bad_database("Invalid state in userroomid_leftstate.")
|
||||||
|
})?;
|
||||||
|
|
||||||
Ok(state)
|
Ok(state)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue