mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-15 21:52:25 +03:00
Use PDU not *Event in HeaderedEvent (#3073)
Requires https://github.com/matrix-org/gomatrixserverlib/pull/376 This has numerous upsides: - Less type casting to `*Event` is required. - Making Dendrite work with `PDU` interfaces means we can swap out Event impls more easily. - Tests which represent weird event shapes are easier to write. Part of a series of refactors on GMSL.
This commit is contained in:
parent
696cbb70b8
commit
f5b3144dc3
64 changed files with 296 additions and 284 deletions
|
@ -24,7 +24,7 @@ import (
|
|||
func IsServerAllowed(
|
||||
serverName spec.ServerName,
|
||||
serverCurrentlyInRoom bool,
|
||||
authEvents []*gomatrixserverlib.Event,
|
||||
authEvents []gomatrixserverlib.PDU,
|
||||
) bool {
|
||||
// In practice should not happen, but avoids unneeded CPU cycles
|
||||
if serverName == "" || len(authEvents) == 0 {
|
||||
|
@ -55,7 +55,7 @@ func IsServerAllowed(
|
|||
return false
|
||||
}
|
||||
|
||||
func HistoryVisibilityForRoom(authEvents []*gomatrixserverlib.Event) gomatrixserverlib.HistoryVisibility {
|
||||
func HistoryVisibilityForRoom(authEvents []gomatrixserverlib.PDU) gomatrixserverlib.HistoryVisibility {
|
||||
// https://matrix.org/docs/spec/client_server/r0.6.0#id87
|
||||
// By default if no history_visibility is set, or if the value is not understood, the visibility is assumed to be shared.
|
||||
visibility := gomatrixserverlib.HistoryVisibilityShared
|
||||
|
@ -70,7 +70,7 @@ func HistoryVisibilityForRoom(authEvents []*gomatrixserverlib.Event) gomatrixser
|
|||
return visibility
|
||||
}
|
||||
|
||||
func IsAnyUserOnServerWithMembership(serverName spec.ServerName, authEvents []*gomatrixserverlib.Event, wantMembership string) bool {
|
||||
func IsAnyUserOnServerWithMembership(serverName spec.ServerName, authEvents []gomatrixserverlib.PDU, wantMembership string) bool {
|
||||
for _, ev := range authEvents {
|
||||
if ev.Type() != spec.MRoomMember {
|
||||
continue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue