Add test ensuring that /make_join and /send_join are rejected during a partial join#432
Conversation
98ff4f0 to
68f1460
Compare
| 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.
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.
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
Lines up with matrix-org/synapse#13416