fix: correct vars in join_callback for space mapping

Resolved incorrect variable usage in join_callback function that affected the mapping of new rooms to the correct spaces. Previously, the event.sender variable was mistakenly used, leading to potential mismatches in identifying the correct user and room IDs for space assignments. This update ensures the response object's sender and room_id properties are correctly utilized, aligning room additions with the intended user spaces.
This commit is contained in:
Kumi 2024-05-18 21:37:51 +02:00
parent 8a253fdf90
commit 99eec5395e
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -8,12 +8,12 @@ async def join_callback(response, bot):
with closing(bot.database.cursor()) as cursor: with closing(bot.database.cursor()) as cursor:
cursor.execute( cursor.execute(
"SELECT space_id FROM user_spaces WHERE user_id = ? AND active = TRUE", (event.sender,)) "SELECT space_id FROM user_spaces WHERE user_id = ? AND active = TRUE", (response.sender,))
space = cursor.fetchone() space = cursor.fetchone()
if space: if space:
bot.logger.log(f"Adding new room to space {space[0]}...") bot.logger.log(f"Adding new room to space {space[0]}...")
await bot.add_rooms_to_space(space[0], [new_room.room_id]) await bot.add_rooms_to_space(space[0], [response.room_id])
bot.matrix_client.keys_upload() bot.matrix_client.keys_upload()