mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-18 04:13:10 -06:00
Try to populate fields based on room version from OutputNewRoomEvent
This commit is contained in:
parent
8591f3c4b3
commit
f5b103b1f0
|
|
@ -27,7 +27,6 @@ import (
|
||||||
"github.com/matrix-org/dendrite/syncapi/types"
|
"github.com/matrix-org/dendrite/syncapi/types"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/tidwall/gjson"
|
|
||||||
sarama "gopkg.in/Shopify/sarama.v1"
|
sarama "gopkg.in/Shopify/sarama.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -100,14 +99,10 @@ func (s *OutputRoomEventConsumer) onNewRoomEvent(
|
||||||
ctx context.Context, msg api.OutputNewRoomEvent,
|
ctx context.Context, msg api.OutputNewRoomEvent,
|
||||||
) error {
|
) error {
|
||||||
ev := msg.Event
|
ev := msg.Event
|
||||||
roomVersion := gomatrixserverlib.RoomVersionV1
|
|
||||||
if rv := gjson.Get(string(ev.Content()), "room_version"); rv.Exists() {
|
|
||||||
roomVersion = gomatrixserverlib.RoomVersion(rv.String())
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := msg.Event.PrepareAs(roomVersion); err != nil {
|
if err := msg.Event.PrepareAs(msg.RoomVersion); err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"room_version": roomVersion,
|
"room_version": msg.RoomVersion,
|
||||||
}).WithError(err).Errorf("can't prepare event to version")
|
}).WithError(err).Errorf("can't prepare event to version")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue