Do the same for leave

This commit is contained in:
Neil Alexander 2022-01-04 15:47:14 +00:00
parent e6be7f05c3
commit 13f9028e7a
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -175,10 +175,16 @@ func SendLeave(
}
}
if event.StateKey() == nil {
if event.StateKey() == nil || event.StateKeyEquals("") {
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.InvalidArgumentValue("missing state_key"),
JSON: jsonerror.BadJSON("No state key was provided in the leave event."),
}
}
if !event.StateKeyEquals(event.Sender()) {
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.BadJSON("Event state key must match the event sender."),
}
}