Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Transfer bans on room upgrade #4642

Merged
merged 5 commits into from
Feb 19, 2019
Merged

Transfer bans on room upgrade #4642

merged 5 commits into from
Feb 19, 2019

Conversation

anoadragon453
Copy link
Member

@anoadragon453 anoadragon453 commented Feb 14, 2019

Transfer bans on a room upgrade.

Closes #4600

Sytest PR: matrix-org/sytest#563

@codecov-io
Copy link

codecov-io commented Feb 14, 2019

Codecov Report

Merging #4642 into develop will increase coverage by 0.01%.
The diff coverage is 100%.

@@             Coverage Diff             @@
##           develop    #4642      +/-   ##
===========================================
+ Coverage    75.17%   75.19%   +0.01%     
===========================================
  Files          340      340              
  Lines        34712    34717       +5     
  Branches      5677     5679       +2     
===========================================
+ Hits         26096    26104       +8     
+ Misses        7013     7012       -1     
+ Partials      1603     1601       -2

@anoadragon453 anoadragon453 requested a review from a team February 14, 2019 14:47
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeahh let's not do this. there's a whole different code path for membership events.

I'd suggest using a completely separate loop in clone_existing_room and calling room_member_handler.update_membership instead.

@anoadragon453
Copy link
Member Author

The problem with room_member_handler.update_membership is that it required a proper User object, and we only have User ID strs from the member event. Is there a way to convert those to User's, even for remote users?

@richvdh
Copy link
Member

richvdh commented Feb 18, 2019

there's a from_string class method

@anoadragon453 anoadragon453 requested a review from a team February 18, 2019 14:02
@anoadragon453 anoadragon453 dismissed richvdh’s stale review February 18, 2019 15:03

Addressed changes

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm otherwise

@@ -285,6 +285,7 @@ def clone_existing_room(
(EventTypes.RoomAvatar, ""),
(EventTypes.Encryption, ""),
(EventTypes.ServerACL, ""),
(EventTypes.Member, None),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would probably be better to do this with a separate call to get_filtered_current_state_ids.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm, in testing this seems to be a few hundred ms slower if we do another call to the DB.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how big was your room? ;-p

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Literally 1 ban and no messages lol

# Transfer membership events
for old_event in member_events:
# Only transfer ban events
logger.info("Event type: " + str(old_event.content))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like it needs to go away

@@ -0,0 +1 @@
Transfer bans on room upgrade.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I call it a feature rather than a bugfix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? All the other room upgrade stuff I've been doing have been bug fixes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd argue that's incorrect, then. This is a new feature for room upgrades as far as I'm concerned.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kk, I have no strong feelings one way or the other.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants