mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 06:53:09 -06:00
Merge branch 'main' of github.com:matrix-org/dendrite into s7evink/v0133
This commit is contained in:
commit
c81465c444
|
|
@ -36,7 +36,7 @@ If you have further questions, please take a look at [our FAQ](docs/FAQ.md) or j
|
|||
See the [Planning your Installation](https://matrix-org.github.io/dendrite/installation/planning) page for
|
||||
more information on requirements.
|
||||
|
||||
To build Dendrite, you will need Go 1.18 or later.
|
||||
To build Dendrite, you will need Go 1.20 or later.
|
||||
|
||||
For a usable federating Dendrite deployment, you will also need:
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ Consider enabling the DNS cache by modifying the `global` section of your config
|
|||
## Time synchronisation
|
||||
|
||||
Matrix relies heavily on TLS which requires the system time to be correct. If the clock
|
||||
drifts then you may find that federation no works reliably (or at all) and clients may
|
||||
drifts then you may find that federation will not work reliably (or at all) and clients may
|
||||
struggle to connect to your Dendrite server.
|
||||
|
||||
Ensure that the time is synchronised on your system by enabling NTP sync.
|
||||
|
|
|
|||
|
|
@ -368,7 +368,16 @@ func (r *Upgrader) generateInitialEvents(ctx context.Context, oldRoom *api.Query
|
|||
// in the create event (such as for the room types MSC).
|
||||
newCreateContent := map[string]interface{}{}
|
||||
_ = json.Unmarshal(oldCreateEvent.Content(), &newCreateContent)
|
||||
newCreateContent["creator"] = string(senderID)
|
||||
|
||||
switch newVersion {
|
||||
case gomatrixserverlib.RoomVersionV11:
|
||||
// RoomVersionV11 removed the creator field from the create content: https://github.com/matrix-org/matrix-spec-proposals/pull/2175
|
||||
// So if we are upgrading from pre v11, we need to remove the field.
|
||||
delete(newCreateContent, "creator")
|
||||
default:
|
||||
newCreateContent["creator"] = senderID
|
||||
}
|
||||
|
||||
newCreateContent["room_version"] = newVersion
|
||||
newCreateContent["predecessor"] = gomatrixserverlib.PreviousRoom{
|
||||
EventID: tombstoneEvent.EventID(),
|
||||
|
|
|
|||
|
|
@ -266,8 +266,8 @@ func (s *OutputRoomEventConsumer) updateMDirect(ctx context.Context, oldRoomID,
|
|||
directChats := gjson.ParseBytes(directChatsRaw)
|
||||
newDirectChats := make(map[string][]string)
|
||||
// iterate over all userID -> roomIDs
|
||||
var found bool
|
||||
directChats.ForEach(func(userID, roomIDs gjson.Result) bool {
|
||||
var found bool
|
||||
for _, roomID := range roomIDs.Array() {
|
||||
newDirectChats[userID.Str] = append(newDirectChats[userID.Str], roomID.Str)
|
||||
// add the new roomID to m.direct
|
||||
|
|
@ -276,22 +276,21 @@ func (s *OutputRoomEventConsumer) updateMDirect(ctx context.Context, oldRoomID,
|
|||
newDirectChats[userID.Str] = append(newDirectChats[userID.Str], newRoomID)
|
||||
}
|
||||
}
|
||||
// Only hit the database if we found the old room as a DM for this user
|
||||
if found {
|
||||
var data []byte
|
||||
data, err = json.Marshal(newDirectChats)
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
if err = s.db.SaveAccountData(ctx, localpart, serverName, "", "m.direct", data); err != nil {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update m.direct state")
|
||||
|
||||
// Only hit the database if we found the old room as a DM for this user
|
||||
if found {
|
||||
var data []byte
|
||||
data, err = json.Marshal(newDirectChats)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = s.db.SaveAccountData(ctx, localpart, serverName, "", "m.direct", data); err != nil {
|
||||
return fmt.Errorf("failed to update m.direct state: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue