Skip to content
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

Transfer bans on room upgrade #4642

Merged
merged 5 commits into from Feb 19, 2019

Conversation

Projects
None yet
3 participants
@anoadragon453
Copy link
Member

anoadragon453 commented Feb 14, 2019

Transfer bans on a room upgrade.

Closes #4600

Sytest PR: matrix-org/sytest#563

@codecov-io

This comment has been minimized.

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 matrix-org/synapse-core Feb 14, 2019

@richvdh
Copy link
Member

richvdh left a comment

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

This comment has been minimized.

Copy link
Member Author

anoadragon453 commented Feb 18, 2019

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

This comment has been minimized.

Copy link
Member

richvdh commented Feb 18, 2019

there's a from_string class method

@anoadragon453 anoadragon453 force-pushed the anoa/bans_room_upgrade branch from 857a63a to 9154210 Feb 18, 2019

@anoadragon453 anoadragon453 requested a review from matrix-org/synapse-core Feb 18, 2019

Addressed changes

@richvdh
Copy link
Member

richvdh left a comment

lgtm otherwise

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

This comment has been minimized.

@richvdh

richvdh Feb 18, 2019

Member

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

This comment has been minimized.

@anoadragon453

anoadragon453 Feb 18, 2019

Author Member

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

This comment has been minimized.

@richvdh

richvdh Feb 18, 2019

Member

how big was your room? ;-p

This comment has been minimized.

@anoadragon453

anoadragon453 Feb 18, 2019

Author Member

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))

This comment has been minimized.

@richvdh

richvdh Feb 18, 2019

Member

this looks like it needs to go away

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

This comment has been minimized.

@richvdh

richvdh Feb 18, 2019

Member

I call it a feature rather than a bugfix.

This comment has been minimized.

@anoadragon453

anoadragon453 Feb 18, 2019

Author Member

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

This comment has been minimized.

@richvdh

richvdh Feb 18, 2019

Member

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

This comment has been minimized.

@anoadragon453

anoadragon453 Feb 18, 2019

Author Member

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

@anoadragon453 anoadragon453 force-pushed the anoa/bans_room_upgrade branch from a70afca to aa4d172 Feb 18, 2019

@anoadragon453 anoadragon453 force-pushed the anoa/bans_room_upgrade branch from aa4d172 to f8b9ca5 Feb 18, 2019

@anoadragon453 anoadragon453 requested a review from richvdh Feb 18, 2019

@anoadragon453 anoadragon453 merged commit 968a30a into develop Feb 19, 2019

7 checks passed

ci/circleci: sytestpy2merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy2postgresmerged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3postgresmerged Your tests passed on CircleCI!
Details
codecov/patch 100% of diff hit (target 0%)
Details
codecov/project 75.19% (target 0%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@anoadragon453 anoadragon453 deleted the anoa/bans_room_upgrade branch Feb 19, 2019

anoadragon453 added a commit to matrix-org/sytest that referenced this pull request Mar 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.