aboutsummaryrefslogtreecommitdiff
path: root/roomserver/state
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-03-16 17:51:58 +0000
committerGitHub <noreply@github.com>2020-03-16 17:51:58 +0000
commit9f74a8798e26d9482f1964ff79a28acfe61d6dd1 (patch)
treefc6db87d0b2701f31ab30157e060ea6b3cb6580d /roomserver/state
parentacb505b71751f637531ba9113d4b4daae589bcbc (diff)
bugfix: Fix #908 by setting the correct state after the event (#913)
* bugfix: Fix #908 by setting the correct state after the event Previously, this would only happen if the state already existed previously! * Structured logging
Diffstat (limited to 'roomserver/state')
-rw-r--r--roomserver/state/v1/state.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/roomserver/state/v1/state.go b/roomserver/state/v1/state.go
index 5683745b..3eb60192 100644
--- a/roomserver/state/v1/state.go
+++ b/roomserver/state/v1/state.go
@@ -366,11 +366,16 @@ func (v StateResolutionV1) loadStateAfterEventsForNumericTuples(
// update that key in the result.
// If the requested event wasn't a state event then the state after
// it is the same as the state before it.
+ set := false
for i := range result {
if result[i].StateKeyTuple == prevState.StateKeyTuple {
result[i] = prevState.StateEntry
+ set = true
}
}
+ if !set { // no previous state exists for this event: add new state
+ result = append(result, prevState.StateEntry)
+ }
}
return result, nil
}