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

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

Merged
merged 6 commits into from
Aug 8, 2022

Conversation

reivilibre
Copy link
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
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
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
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

@clokep
Copy link
Member

clokep commented Aug 3, 2022

Do we need similar tests for knocking?

@reivilibre
Copy link
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
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