mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-06 22:43:10 -06:00
Add IsStateEvent utility method for checking if EventStateKeyNID is 0
This commit is contained in:
parent
8526277736
commit
2a33b17ee1
|
|
@ -124,7 +124,7 @@ func calculateAndStoreStateMany(db RoomEventDatabase, roomNID types.RoomNID, pre
|
|||
}
|
||||
fullState = append(fullState, entries...)
|
||||
}
|
||||
if prevState.EventStateKeyNID != 0 {
|
||||
if prevState.IsStateEvent() {
|
||||
// If the prev event was a state event then add an entry for the event itself
|
||||
// so that we get the state after the event rather than the state before.
|
||||
fullState = append(fullState, prevState.StateEntry)
|
||||
|
|
|
|||
|
|
@ -74,6 +74,11 @@ type StateAtEvent struct {
|
|||
StateEntry
|
||||
}
|
||||
|
||||
// IsStateEvent returns whether the event the state is at is a state event.
|
||||
func (s StateAtEvent) IsStateEvent() bool {
|
||||
return s.EventStateKeyNID != 0
|
||||
}
|
||||
|
||||
// An Event is a gomatrixserverlib.Event with the numeric event ID attached.
|
||||
// It is when performing bulk event lookup in the database.
|
||||
type Event struct {
|
||||
|
|
|
|||
Loading…
Reference in a new issue