mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 15:03:09 -06:00
treat no sender ID as not joined to room in sendevent
- returning 403 forbidden instead of 404 not found
This commit is contained in:
parent
ff18671fb0
commit
590d5a27ea
|
|
@ -316,11 +316,18 @@ func generateSendEvent(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
senderID, err := rsAPI.QuerySenderIDForUser(ctx, *validRoomID, *fullUserID)
|
senderID, err := rsAPI.QuerySenderIDForUser(ctx, *validRoomID, *fullUserID)
|
||||||
if err != nil || senderID == nil {
|
if err != nil {
|
||||||
return nil, &util.JSONResponse{
|
return nil, &util.JSONResponse{
|
||||||
Code: http.StatusNotFound,
|
Code: http.StatusNotFound,
|
||||||
JSON: spec.NotFound("Unable to find senderID for user"),
|
JSON: spec.NotFound("Unable to find senderID for user"),
|
||||||
}
|
}
|
||||||
|
} else if senderID == nil {
|
||||||
|
// TODO: is it always the case that lack of a sender ID means they're not joined?
|
||||||
|
// And should this logic be deferred to the roomserver somehow?
|
||||||
|
return nil, &util.JSONResponse{
|
||||||
|
Code: http.StatusForbidden,
|
||||||
|
JSON: spec.Forbidden("not joined to room"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the new event and set all the fields we can
|
// create the new event and set all the fields we can
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue