-
Notifications
You must be signed in to change notification settings - Fork 55
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
Conversation
98ff4f0
to
68f1460
Compare
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() |
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.
this isn't very go-like. Instead:
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.
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.
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
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. |
6b184bd
to
9b0a0c0
Compare
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.
lgtm
Lines up with matrix-org/synapse#13416