mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-21 13:03:09 -06:00
Linter
This commit is contained in:
parent
2ae80497d2
commit
4b34c1bf0f
|
|
@ -22,9 +22,10 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
userAPI "github.com/matrix-org/dendrite/userapi/api"
|
userAPI "github.com/matrix-org/dendrite/userapi/api"
|
||||||
"github.com/tidwall/gjson"
|
"github.com/tidwall/gjson"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
|
|
|
||||||
|
|
@ -273,8 +273,9 @@ func (r *Joiner) performJoinRoomByID(
|
||||||
|
|
||||||
// If a guest is trying to join a room, check that the room has a m.room.guest_access event
|
// If a guest is trying to join a room, check that the room has a m.room.guest_access event
|
||||||
if req.IsGuest {
|
if req.IsGuest {
|
||||||
|
var guestAccessEvent *gomatrixserverlib.HeaderedEvent
|
||||||
guestAccess := "forbidden"
|
guestAccess := "forbidden"
|
||||||
guestAccessEvent, err := r.DB.GetStateEvent(ctx, req.RoomIDOrAlias, gomatrixserverlib.MRoomGuestAccess, "")
|
guestAccessEvent, err = r.DB.GetStateEvent(ctx, req.RoomIDOrAlias, gomatrixserverlib.MRoomGuestAccess, "")
|
||||||
if err == nil && guestAccessEvent != nil {
|
if err == nil && guestAccessEvent != nil {
|
||||||
guestAccess = gjson.GetBytes(guestAccessEvent.Content(), "guest_access").String()
|
guestAccess = gjson.GetBytes(guestAccessEvent.Content(), "guest_access").String()
|
||||||
}
|
}
|
||||||
|
|
@ -284,7 +285,7 @@ func (r *Joiner) performJoinRoomByID(
|
||||||
if guestAccess != "can_join" {
|
if guestAccess != "can_join" {
|
||||||
return "", "", &rsAPI.PerformError{
|
return "", "", &rsAPI.PerformError{
|
||||||
Code: rsAPI.PerformErrorNotAllowed,
|
Code: rsAPI.PerformErrorNotAllowed,
|
||||||
Msg: fmt.Sprintf("Guest access is forbidden"),
|
Msg: "Guest access is forbidden",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue