mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Tweak join rule unmarshalling
This commit is contained in:
parent
84c7205b54
commit
e9bee83b03
1 changed files with 13 additions and 8 deletions
|
@ -144,17 +144,22 @@ func MakeJoin(
|
||||||
provider := gomatrixserverlib.NewAuthEvents(stateEvents)
|
provider := gomatrixserverlib.NewAuthEvents(stateEvents)
|
||||||
|
|
||||||
// Check the join rules. If it's a restricted join then there are special rules.
|
// Check the join rules. If it's a restricted join then there are special rules.
|
||||||
var joinRuleEvent *gomatrixserverlib.Event
|
joinRules := gomatrixserverlib.JoinRuleContent{
|
||||||
var joinRules gomatrixserverlib.JoinRuleContent
|
JoinRule: gomatrixserverlib.Public, // Default join rule if not specified.
|
||||||
if joinRuleEvent, err = provider.JoinRules(); err != nil {
|
}
|
||||||
|
joinRuleEvent, err := provider.JoinRules()
|
||||||
|
if err != nil {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusNotFound,
|
Code: http.StatusNotFound,
|
||||||
JSON: jsonerror.NotFound("Room join rules do not exist"),
|
JSON: jsonerror.NotFound("Failed to retrieve join rules"),
|
||||||
}
|
}
|
||||||
} else if err = json.Unmarshal(joinRuleEvent.Content(), &joinRules); err != nil {
|
}
|
||||||
return util.JSONResponse{
|
if joinRuleEvent != nil {
|
||||||
Code: http.StatusBadRequest,
|
if err = json.Unmarshal(joinRuleEvent.Content(), &joinRules); err != nil {
|
||||||
JSON: jsonerror.Unknown("Failed to unmarshal room join rules"),
|
return util.JSONResponse{
|
||||||
|
Code: http.StatusBadRequest,
|
||||||
|
JSON: jsonerror.Unknown("Failed to unmarshal room join rules"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue