diff --git a/src/github.com/matrix-org/dendrite/federationapi/routing/missingevents.go b/src/github.com/matrix-org/dendrite/federationapi/routing/missingevents.go index 2e0f51e73..0165b8a68 100644 --- a/src/github.com/matrix-org/dendrite/federationapi/routing/missingevents.go +++ b/src/github.com/matrix-org/dendrite/federationapi/routing/missingevents.go @@ -30,8 +30,8 @@ type getMissingEventRequest struct { MinDepth int64 `json:"min_depth"` } -// GetMissingEvents returns missing event between earliest_events & latest_events. -// Events are fetched from room DAG starting from latest_events until we reach earliest_events or the limit +// GetMissingEvents returns missing events between earliest_events & latest_events. +// Events are fetched from room DAG starting from latest_events until we reach earliest_events or the limit. func GetMissingEvents( httpReq *http.Request, request *gomatrixserverlib.FederationRequest, diff --git a/src/github.com/matrix-org/dendrite/roomserver/api/query.go b/src/github.com/matrix-org/dendrite/roomserver/api/query.go index f0a1d3a1c..258f31c1b 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/api/query.go +++ b/src/github.com/matrix-org/dendrite/roomserver/api/query.go @@ -154,9 +154,9 @@ type QueryServerAllowedToSeeEventResponse struct { AllowedToSeeEvent bool `json:"can_see_event"` } -// QueryMissingEventsRequest is request to QueryMissingEvents +// QueryMissingEventsRequest is a request to QueryMissingEvents type QueryMissingEventsRequest struct { - // Events which are known previous to the gap in timeline. + // Events which are known previous to the gap in the timeline. EarliestEvents []string `json:"earliest_events"` // Latest known events. LatestEvents []string `json:"latest_events"` @@ -166,7 +166,7 @@ type QueryMissingEventsRequest struct { ServerName gomatrixserverlib.ServerName `json:"server_name"` } -// QueryMissingEventsResponse is response to QueryMissingEvents +// QueryMissingEventsResponse is a response to QueryMissingEvents type QueryMissingEventsResponse struct { // Missing events, arbritrary order. Events []gomatrixserverlib.Event `json:"events"` diff --git a/src/github.com/matrix-org/dendrite/roomserver/auth/auth.go b/src/github.com/matrix-org/dendrite/roomserver/auth/auth.go index 7d6697726..2dce6f6dc 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/auth/auth.go +++ b/src/github.com/matrix-org/dendrite/roomserver/auth/auth.go @@ -14,12 +14,13 @@ package auth import "github.com/matrix-org/gomatrixserverlib" -// IsServerAllowed checks if a server has a client as member in authEvents +// IsServerAllowed returns true if there exists a event in authEvents +// which allows server to view this event. That is true when a client on the server +// can view the event. Otherwise returns false. func IsServerAllowed( serverName gomatrixserverlib.ServerName, authEvents []gomatrixserverlib.Event, ) bool { - isInRoom := false for _, ev := range authEvents { membership, err := ev.Membership() if err != nil || membership != "join" { @@ -37,11 +38,10 @@ func IsServerAllowed( } if domain == serverName { - isInRoom = true - break + return true } } // TODO: Check if history visibility is shared and if the server is currently in the room - return isInRoom + return false }