mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-10 16:33:11 -06:00
More review comments
This commit is contained in:
parent
f26dad5dce
commit
da858d6b65
|
|
@ -185,7 +185,7 @@ func (s *OutputRoomEvent) joinedHostsAtEvent(
|
|||
|
||||
joined := map[gomatrixserverlib.ServerName]bool{}
|
||||
for _, joinedHost := range oldJoinedHosts {
|
||||
if removed[joinedHost.EventID] {
|
||||
if removed[joinedHost.MemberEventID] {
|
||||
// This m.room.member event is part of the current state of the
|
||||
// room, but not part of the state at the event we are processing
|
||||
// Therefore we can't use it to tell whether the server was in
|
||||
|
|
@ -233,7 +233,7 @@ func joinedHostsFromEvents(evs []gomatrixserverlib.Event) ([]types.JoinedHost, e
|
|||
return nil, err
|
||||
}
|
||||
joinedHosts = append(joinedHosts, types.JoinedHost{
|
||||
EventID: ev.EventID(), ServerName: serverName,
|
||||
MemberEventID: ev.EventID(), ServerName: serverName,
|
||||
})
|
||||
}
|
||||
return joinedHosts, nil
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ package storage
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"github.com/lib/pq"
|
||||
"github.com/matrix-org/dendrite/federationsender/types"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
|
|
@ -101,8 +102,8 @@ func (s *joinedHostsStatements) selectJoinedHosts(txn *sql.Tx, roomID string,
|
|||
return nil, err
|
||||
}
|
||||
result = append(result, types.JoinedHost{
|
||||
EventID: eventID,
|
||||
ServerName: gomatrixserverlib.ServerName(serverName),
|
||||
MemberEventID: eventID,
|
||||
ServerName: gomatrixserverlib.ServerName(serverName),
|
||||
})
|
||||
}
|
||||
return result, nil
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ package storage
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"github.com/matrix-org/dendrite/common"
|
||||
"github.com/matrix-org/dendrite/federationsender/types"
|
||||
)
|
||||
|
|
@ -91,7 +92,7 @@ func (d *Database) UpdateRoom(
|
|||
return err
|
||||
}
|
||||
for _, add := range addHosts {
|
||||
err = d.insertJoinedHosts(txn, roomID, add.EventID, add.ServerName)
|
||||
err = d.insertJoinedHosts(txn, roomID, add.MemberEventID, add.ServerName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@ import (
|
|||
|
||||
// A JoinedHost is a server that is joined to a matrix room.
|
||||
type JoinedHost struct {
|
||||
// The EventID of a m.room.member join event.
|
||||
EventID string
|
||||
// The MemberEventID of a m.room.member join event.
|
||||
MemberEventID string
|
||||
// The domain part of the state key of the m.room.member join event
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
}
|
||||
|
||||
// A EventIDMismatchError indicates that we have got out of sync with the
|
||||
// rooms erver.
|
||||
// rooms server.
|
||||
type EventIDMismatchError struct {
|
||||
// The event ID we have stored in our local database.
|
||||
DatabaseID string
|
||||
|
|
@ -37,9 +37,9 @@ type EventIDMismatchError struct {
|
|||
RoomServerID string
|
||||
}
|
||||
|
||||
func (l EventIDMismatchError) Error() string {
|
||||
func (e EventIDMismatchError) Error() string {
|
||||
return fmt.Sprintf(
|
||||
"mismatched last sent event ID: had %q in database got %q from room server",
|
||||
l.DatabaseID, l.RoomServerID,
|
||||
e.DatabaseID, e.RoomServerID,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue