-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Prevent message search in upgraded rooms we're not in #6385
Conversation
…_search_predecessor_room
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this fixes the bug...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry anoa, but this feels like a very complicated way of solving the problem. How about this:
# the initial room must have been known for us to get this far.
predecessor_room = yield self.store.get_room_predecessor(room_id)
while True:
if not predecessor_room:
# We have reached the end of the chain of predecessors
break
predecessor_room_id = predecessor["room_id"]
# don't add it to the list until we have checked that we are in the room.
try:
next_predecessor_room = yield self.store.get_room_predecessor(
predecessor_room_id
)
except NotFoundError:
# The predecessor is not a known room, so we are done here
break
historical_room_ids.append(predecessor_room_id)
# and repeat
predecessor_room = next_predecessor_room
return historical_room_ids
We would still need to check that predecessor actually contained a room_id first, right? |
I've implemented a very similar version, thanks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgmt!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
* commit 'ea0f0ad41': Prevent message search in upgraded rooms we're not in (#6385)
Fixes #6356
I assume this is preferred instead of attempting to join the predecessor room before searching it, as that could be slow and we may not be able to join.