Kumi
99eec5395e
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.
20 lines
No EOL
735 B
Python
20 lines
No EOL
735 B
Python
from contextlib import closing
|
|
|
|
async def join_callback(response, bot):
|
|
bot.logger.log(
|
|
f"Join response received for room {response.room_id}", "debug")
|
|
|
|
bot.matrix_client.joined_rooms()
|
|
|
|
with closing(bot.database.cursor()) as cursor:
|
|
cursor.execute(
|
|
"SELECT space_id FROM user_spaces WHERE user_id = ? AND active = TRUE", (response.sender,))
|
|
space = cursor.fetchone()
|
|
|
|
if space:
|
|
bot.logger.log(f"Adding new room to space {space[0]}...")
|
|
await bot.add_rooms_to_space(space[0], [response.room_id])
|
|
|
|
bot.matrix_client.keys_upload()
|
|
|
|
await bot.send_message(bot.matrix_client.rooms[response.room_id], "Hello! Thanks for inviting me! How can I help you today?") |