Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix null prev_events and auth_events fields from being sent to homeservers #46

Merged
merged 1 commit into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions internal/federation/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ func (s *Server) MakeAliasMapping(aliasLocalpart, roomID string) string {
func (s *Server) MustMakeRoom(t *testing.T, roomVer gomatrixserverlib.RoomVersion, events []b.Event) *ServerRoom {
roomID := fmt.Sprintf("!%d:%s", len(s.rooms), s.ServerName)
room := &ServerRoom{
RoomID: roomID,
Version: roomVer,
State: make(map[string]*gomatrixserverlib.Event),
RoomID: roomID,
Version: roomVer,
State: make(map[string]*gomatrixserverlib.Event),
ForwardExtremities: make([]string, 0),
}
// sign all these events
for _, ev := range events {
Expand Down
3 changes: 3 additions & 0 deletions internal/federation/server_room.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ func (r *ServerRoom) AddEvent(ev *gomatrixserverlib.Event) {

// AuthEvents returns the state event IDs of the auth events which authenticate this event
func (r *ServerRoom) AuthEvents(sn gomatrixserverlib.StateNeeded) (eventIDs []string) {
// Guard against returning a nil string slice
eventIDs = make([]string, 0)

appendIfExists := func(evType, stateKey string) {
ev := r.CurrentState(evType, stateKey)
if ev == nil {
Expand Down