mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-09 07:03:10 -06:00
More input tweaks
This commit is contained in:
parent
175989e363
commit
8048c77526
|
|
@ -60,8 +60,9 @@ import (
|
|||
// per-room durable consumers will only progress through the stream
|
||||
// as events are processed.
|
||||
//
|
||||
// A BC * -> positions of each consumer (* = ephemeral)
|
||||
// ⌄ ⌄⌄ ⌄
|
||||
// A BC * -> positions of each consumer (* = ephemeral)
|
||||
// ⌄ ⌄⌄ ⌄
|
||||
//
|
||||
// ABAABCAABCAA -> newest (letter = subject for each message)
|
||||
//
|
||||
// In this example, A is still processing an event but has two
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ func (r *Inputer) processRoomEvent(
|
|||
return fmt.Errorf("r.DB.RoomInfo: %w", rerr)
|
||||
}
|
||||
isCreateEvent := event.Type() == gomatrixserverlib.MRoomCreate && event.StateKeyEquals("")
|
||||
if roomInfo == nil && !isCreateEvent {
|
||||
if !isCreateEvent && (roomInfo == nil || roomInfo.IsStub()) {
|
||||
return fmt.Errorf("room %s does not exist for event %s", event.RoomID(), event.EventID())
|
||||
}
|
||||
|
||||
|
|
@ -341,7 +341,7 @@ func (r *Inputer) processRoomEvent(
|
|||
if err != nil {
|
||||
return fmt.Errorf("updater.RoomInfo: %w", err)
|
||||
}
|
||||
if roomInfo == nil {
|
||||
if roomInfo == nil || (!isCreateEvent && roomInfo.IsStub()) {
|
||||
return fmt.Errorf("updater.RoomInfo missing for room %s", event.RoomID())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,17 +35,17 @@ import (
|
|||
// event to the output log.
|
||||
// The latest events are the events that aren't referenced by another event in the database:
|
||||
//
|
||||
// Time goes down the page. 1 is the m.room.create event (root).
|
||||
// Time goes down the page. 1 is the m.room.create event (root).
|
||||
//
|
||||
// 1 After storing 1 the latest events are {1}
|
||||
// | After storing 2 the latest events are {2}
|
||||
// 2 After storing 3 the latest events are {3}
|
||||
// / \ After storing 4 the latest events are {3,4}
|
||||
// 3 4 After storing 5 the latest events are {5,4}
|
||||
// | | After storing 6 the latest events are {5,6}
|
||||
// 5 6 <--- latest After storing 7 the latest events are {6,7}
|
||||
// |
|
||||
// 7 <----- latest
|
||||
// 1 After storing 1 the latest events are {1}
|
||||
// | After storing 2 the latest events are {2}
|
||||
// 2 After storing 3 the latest events are {3}
|
||||
// / \ After storing 4 the latest events are {3,4}
|
||||
// 3 4 After storing 5 the latest events are {5,4}
|
||||
// | | After storing 6 the latest events are {5,6}
|
||||
// 5 6 <--- latest After storing 7 the latest events are {6,7}
|
||||
// |
|
||||
// 7 <----- latest
|
||||
//
|
||||
// Can only be called once at a time
|
||||
func (r *Inputer) updateLatestEvents(
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ func (d *Database) roomInfo(ctx context.Context, txn *sql.Tx, roomID string) (*t
|
|||
}
|
||||
// Otherwise, try to admit the data into the cache and return the
|
||||
// new reference from the database.
|
||||
if roomInfoFromDB != nil {
|
||||
if err == nil && roomInfoFromDB != nil {
|
||||
d.Cache.StoreRoomInfo(roomID, roomInfoFromDB)
|
||||
d.Cache.StoreRoomServerRoomID(roomInfoFromDB.RoomNID, roomID)
|
||||
}
|
||||
|
|
@ -840,8 +840,9 @@ func extractRoomVersionFromCreateEvent(event *gomatrixserverlib.Event) (
|
|||
// "servers should not apply or send redactions to clients until both the redaction event and original event have been seen, and are valid."
|
||||
// https://matrix.org/docs/spec/rooms/v3#authorization-rules-for-events
|
||||
// These cases are:
|
||||
// - This is a redaction event, redact the event it references if we know about it.
|
||||
// - This is a normal event which may have been previously redacted.
|
||||
// - This is a redaction event, redact the event it references if we know about it.
|
||||
// - This is a normal event which may have been previously redacted.
|
||||
//
|
||||
// In the first case, check if we have the referenced event then apply the redaction, else store it
|
||||
// in the redactions table with validated=FALSE. In the second case, check if there is a redaction for it:
|
||||
// if there is then apply the redactions and set validated=TRUE.
|
||||
|
|
|
|||
Loading…
Reference in a new issue