mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 21:12:45 +00:00
Implement room version capabilities in CS API (#866)
* Add wiring for querying the roomserver for the default room version * Try to implement /capabilities for room versions * Update copyright notices * Update sytests, add /capabilities endpoint into CS API * Update sytest-whitelist * Add GetDefaultRoomVersion * Fix cases where state package was shadowed * Fix version formatting * Update Dockerfile to Go 1.13.6 * oh yes types I remember * And fix the default too
This commit is contained in:
parent
880d8ae024
commit
c20109a573
14 changed files with 208 additions and 19 deletions
|
@ -1,4 +1,6 @@
|
|||
// Copyright 2017 Vector Creations Ltd
|
||||
// Copyright 2018 New Vector Ltd
|
||||
// Copyright 2019-2020 The Matrix.org Foundation C.I.C.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -151,7 +153,7 @@ func calculateAndSetState(
|
|||
event gomatrixserverlib.Event,
|
||||
) error {
|
||||
// TODO: get the correct room version
|
||||
state, err := state.GetStateResolutionAlgorithm(state.StateResolutionAlgorithmV1, db)
|
||||
roomState, err := state.GetStateResolutionAlgorithm(state.StateResolutionAlgorithmV1, db)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -169,7 +171,7 @@ func calculateAndSetState(
|
|||
}
|
||||
} else {
|
||||
// We haven't been told what the state at the event is so we need to calculate it from the prev_events
|
||||
if stateAtEvent.BeforeStateSnapshotNID, err = state.CalculateAndStoreStateBeforeEvent(ctx, event, roomNID); err != nil {
|
||||
if stateAtEvent.BeforeStateSnapshotNID, err = roomState.CalculateAndStoreStateBeforeEvent(ctx, event, roomNID); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
// Copyright 2017 Vector Creations Ltd
|
||||
// Copyright 2018 New Vector Ltd
|
||||
// Copyright 2019-2020 The Matrix.org Foundation C.I.C.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -172,7 +174,7 @@ func (u *latestEventsUpdater) doUpdateLatestEvents() error {
|
|||
func (u *latestEventsUpdater) latestState() error {
|
||||
var err error
|
||||
// TODO: get the correct room version
|
||||
state, err := state.GetStateResolutionAlgorithm(state.StateResolutionAlgorithmV1, u.db)
|
||||
roomState, err := state.GetStateResolutionAlgorithm(state.StateResolutionAlgorithmV1, u.db)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -181,21 +183,21 @@ func (u *latestEventsUpdater) latestState() error {
|
|||
for i := range u.latest {
|
||||
latestStateAtEvents[i] = u.latest[i].StateAtEvent
|
||||
}
|
||||
u.newStateNID, err = state.CalculateAndStoreStateAfterEvents(
|
||||
u.newStateNID, err = roomState.CalculateAndStoreStateAfterEvents(
|
||||
u.ctx, u.roomNID, latestStateAtEvents,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
u.removed, u.added, err = state.DifferenceBetweeenStateSnapshots(
|
||||
u.removed, u.added, err = roomState.DifferenceBetweeenStateSnapshots(
|
||||
u.ctx, u.oldStateNID, u.newStateNID,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
u.stateBeforeEventRemoves, u.stateBeforeEventAdds, err = state.DifferenceBetweeenStateSnapshots(
|
||||
u.stateBeforeEventRemoves, u.stateBeforeEventAdds, err = roomState.DifferenceBetweeenStateSnapshots(
|
||||
u.ctx, u.newStateNID, u.stateAtEvent.BeforeStateSnapshotNID,
|
||||
)
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue