Skip to content

Add test ensuring that /make_join and /send_join are rejected during a partial join#432

Merged
reivilibre merged 6 commits into
mainfrom
rei/frj_send_join_during_partial_join
Aug 8, 2022
Merged

Add test ensuring that /make_join and /send_join are rejected during a partial join#432
reivilibre merged 6 commits into
mainfrom
rei/frj_send_join_during_partial_join

Conversation

@reivilibre
Copy link
Copy Markdown
Contributor

Lines up with matrix-org/synapse#13416

@reivilibre reivilibre force-pushed the rei/frj_send_join_during_partial_join branch from 98ff4f0 to 68f1460 Compare August 2, 2022 14:38
@reivilibre reivilibre marked this pull request as ready for review August 2, 2022 15:35
@reivilibre reivilibre requested review from a team as code owners August 2, 2022 15:35
@richvdh richvdh self-requested a review August 3, 2022 09:00
Comment thread internal/federation/handle.go Outdated
w.Write([]byte("complement: HandleMakeSendJoinRequests make_join cannot set membership content: " + err.Error()))
err2 := builder.SetContent(map[string]interface{}{"membership": gomatrixserverlib.Join})
if err2 != nil {
err = "complement: HandleMakeSendJoinRequests make_join cannot set membership content: " + err2.Error()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this isn't very go-like. Instead:

Suggested change
err = "complement: HandleMakeSendJoinRequests make_join cannot set membership content: " + err2.Error()
err = fmt.Errorf("make_join cannot set membership content: %w", err2)

(and add the complement: HandleMakeSendJoinRequests back in, well, HandleMakeSendJoinRequests)

... which also means you don't need to mess about with err2, because everything is an Error.

likewise below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, good tool to have in the toolbox — I was really struggling with this part and knew that err2 had to be a silly workaround.

Let me know if you spot any other improvements I should make here

Comment thread internal/federation/handle.go Outdated
Comment thread tests/federation_room_join_partial_state_test.go Outdated
Comment thread tests/federation_room_join_partial_state_test.go Outdated
@clokep
Copy link
Copy Markdown
Member

clokep commented Aug 3, 2022

Do we need similar tests for knocking?

@reivilibre
Copy link
Copy Markdown
Contributor Author

Do we need similar tests for knocking?

good point. I'll defer this to another PR because this one is already growing enough. Once this one is done, doing one for knocking should likely be easy to get approved.

@reivilibre reivilibre force-pushed the rei/frj_send_join_during_partial_join branch from 6b184bd to 9b0a0c0 Compare August 4, 2022 16:04
@reivilibre reivilibre requested a review from richvdh August 4, 2022 16:09
Copy link
Copy Markdown
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants