-
Notifications
You must be signed in to change notification settings - Fork 508
Fix bug where ephemeral events were not filtered by room ID #19002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
77ab231
b9ffb45
097c483
d98a0ba
62c1eac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix bug where ephemeral events were not filtered by room ID. Contributed by @frastefanini. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -578,12 +578,8 @@ async def ephemeral_by_room( | |
| ephemeral_by_room: JsonDict = {} | ||
|
|
||
| for event in typing: | ||
| # we want to exclude the room_id from the event, but modifying the | ||
| # result returned by the event source is poor form (it might cache | ||
| # the object) | ||
| room_id = event["room_id"] | ||
| event_copy = {k: v for (k, v) in event.items() if k != "room_id"} | ||
| ephemeral_by_room.setdefault(room_id, []).append(event_copy) | ||
| ephemeral_by_room.setdefault(room_id, []).append(event) | ||
|
|
||
| receipt_key = ( | ||
| since_token.receipt_key | ||
|
|
@@ -603,9 +599,7 @@ async def ephemeral_by_room( | |
|
|
||
| for event in receipts: | ||
| room_id = event["room_id"] | ||
| # exclude room id, as above | ||
| event_copy = {k: v for (k, v) in event.items() if k != "room_id"} | ||
| ephemeral_by_room.setdefault(room_id, []).append(event_copy) | ||
| ephemeral_by_room.setdefault(room_id, []).append(event) | ||
|
|
||
| return now_token, ephemeral_by_room | ||
|
|
||
|
|
@@ -2734,9 +2728,13 @@ async def _generate_room_entry( | |
| ) | ||
| ) | ||
|
|
||
| ephemeral = await sync_config.filter_collection.filter_room_ephemeral( | ||
| ephemeral | ||
| ) | ||
| ephemeral = [ | ||
| # exclude room id | ||
| {k: v for (k, v) in event.items() if k != "room_id"} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main difference I see from the previous implementation is that we previously we only removed the But now we filter The other fix where we pass in the the full EDU to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't see a functional change, and I think the conceptual change is OK?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the explaining 👍 I didn't pick up on the tenuous connection. |
||
| for event in await sync_config.filter_collection.filter_room_ephemeral( | ||
| ephemeral | ||
| ) | ||
| ] | ||
|
|
||
| if not ( | ||
| always_include | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.