Store room info when joining a room.

This commit is contained in:
projectmoon 2020-11-29 17:06:04 +00:00
parent c8c38ac1d4
commit 118e4b00c7
1 changed files with 10 additions and 0 deletions

View File

@ -100,6 +100,16 @@ async fn record_room_information(
) -> Result<(), crate::db::errors::DataError> {
let room_id_str = room.room_id.as_str();
let usernames = matrix::get_users_in_room(&client, &room.room_id).await;
let info = crate::models::RoomInfo {
room_id: room_id_str.to_owned(),
room_name: room.display_name(),
};
// TODO this and the username adding should be one whole
// transaction in the db.
db.rooms.insert_room_info(&info)?;
usernames
.into_iter()
.filter(|username| username != our_username)