This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Migrate direct message and tag state on room upgrade #4412
Migrate direct message and tag state on room upgrade #4412
Changes from 12 commits
75942af
4ff6d22
1f18c7c
887ca93
ea8903f
25d64a8
8c85f08
48951f4
8086a5c
c4875d8
117bc94
766a172
0862d35
821b65a
6f3fda7
516456b
c4cdafa
8265995
da0d221
9244a30
1ce4639
4026d55
f0e96ab
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
presumably we can use the method from the search PR for this
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.
Ah, we can but it's inside
SearchHandler
:synapse/synapse/handlers/search.py
Lines 41 to 56 in b1b6dba
Shall I move it to the store instead?
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 was thinking specifically of
get_room_predecessor
, which is in the Store I think?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.
Oh, so it is. Will add, 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.
given you just want the first item in the tuple you can write:
which then saves the slightly cryptic
[0]
indexes laterThere 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.
Ohh, nice one. I love destructuring.
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.
feels weird when this is up here and not used until later on
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.
suggest you do
direct_rooms = user_account_data.get("m.direct", {})
and you can drop these conditions.HOWEVER it may be worth sanity-checking that nobody has decided to make
m.direct
a list or something else other than a dict, soif isinstance(direct_rooms, dict)
.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.
think this condition is redundant?
get_tags_for_room
always returns a dict, even if it's empty.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.
for tag, tag_content in room_tags.items():
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.
Oof, I think I got lost in thinking how the tag data was structured to realize how clunky that code was.
Thanks for pointing it out.