mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 06:53:09 -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...)
|
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
|
// 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.
|
// so that we get the state after the event rather than the state before.
|
||||||
fullState = append(fullState, prevState.StateEntry)
|
fullState = append(fullState, prevState.StateEntry)
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,11 @@ type StateAtEvent struct {
|
||||||
StateEntry
|
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.
|
// An Event is a gomatrixserverlib.Event with the numeric event ID attached.
|
||||||
// It is when performing bulk event lookup in the database.
|
// It is when performing bulk event lookup in the database.
|
||||||
type Event struct {
|
type Event struct {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue