diff --git a/CHANGES.md b/CHANGES.md index 55df36f96..cdeb1dea3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,22 @@ # Changelog +## Dendrite 0.10.7 (2022-11-04) + +### Features + +* Dendrite will now use a native SQLite port when building with `CGO_ENABLED=0` +* A number of `thirdparty` endpoints have been added, improving support for appservices + +### Fixes + +* The `"state"` section of the `/sync` response is no longer limited, so state events should not be dropped unexpectedly +* The deduplication of the `"timeline"` and `"state"` sections in `/sync` is now performed after applying history visibility, so state events should not be dropped unexpectedly +* The `prev_batch` token returned by `/sync` is now calculated after applying history visibility, so that the pagination boundaries are correct +* The room summary membership counts in `/sync` should now be calculated properly in more cases +* A false membership leave event should no longer be sent down `/sync` as a result of retiring an accepted invite (contributed by [tak-hntlabs](https://github.com/tak-hntlabs)) +* Presence updates are now only sent to other servers for which the user shares rooms +* A bug which could cause a panic when converting events into the `ClientEvent` format has been fixed + ## Dendrite 0.10.6 (2022-11-01) ### Features diff --git a/Dockerfile b/Dockerfile index 630dd4662..499992343 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ ARG TARGETARCH ARG FLAGS RUN --mount=target=. \ --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/go/pkg/mod \ USERARCH=`go env GOARCH` \ GOARCH="$TARGETARCH" \ GOOS="linux" \ diff --git a/build/docker/Dockerfile.demo-pinecone b/build/docker/Dockerfile.demo-pinecone index ed41f91af..9393f0b3c 100644 --- a/build/docker/Dockerfile.demo-pinecone +++ b/build/docker/Dockerfile.demo-pinecone @@ -8,6 +8,11 @@ FROM docker.io/golang:1.19-alpine AS base # >>>>>>>> 5a5e4a4ba659aafc62d142561dbd221c6b8020ec:servers/dendrite/build/docker/Dockerfile.demo-pinecone +# +# Needs to be separate from the main Dockerfile for OpenShift, +# as --target is not supported there. +# + RUN apk --update --no-cache add bash build-base WORKDIR /build diff --git a/federationapi/consumers/presence.go b/federationapi/consumers/presence.go index 3445d34a9..153fc40b5 100644 --- a/federationapi/consumers/presence.go +++ b/federationapi/consumers/presence.go @@ -22,6 +22,7 @@ import ( "github.com/matrix-org/dendrite/federationapi/queue" "github.com/matrix-org/dendrite/federationapi/storage" fedTypes "github.com/matrix-org/dendrite/federationapi/types" + roomserverAPI "github.com/matrix-org/dendrite/roomserver/api" "github.com/matrix-org/dendrite/setup/config" "github.com/matrix-org/dendrite/setup/jetstream" "github.com/matrix-org/dendrite/setup/process" @@ -39,6 +40,7 @@ type OutputPresenceConsumer struct { db storage.Database queues *queue.OutgoingQueues isLocalServerName func(gomatrixserverlib.ServerName) bool + rsAPI roomserverAPI.FederationRoomserverAPI topic string outboundPresenceEnabled bool } @@ -50,6 +52,7 @@ func NewOutputPresenceConsumer( js nats.JetStreamContext, queues *queue.OutgoingQueues, store storage.Database, + rsAPI roomserverAPI.FederationRoomserverAPI, ) *OutputPresenceConsumer { return &OutputPresenceConsumer{ ctx: process.Context(), @@ -60,6 +63,7 @@ func NewOutputPresenceConsumer( durable: cfg.Matrix.JetStream.Durable("FederationAPIPresenceConsumer"), topic: cfg.Matrix.JetStream.Prefixed(jetstream.OutputPresenceEvent), outboundPresenceEnabled: cfg.Matrix.Presence.EnableOutbound, + rsAPI: rsAPI, } } @@ -89,6 +93,16 @@ func (t *OutputPresenceConsumer) onMessage(ctx context.Context, msgs []*nats.Msg return true } + var queryRes roomserverAPI.QueryRoomsForUserResponse + err = t.rsAPI.QueryRoomsForUser(t.ctx, &roomserverAPI.QueryRoomsForUserRequest{ + UserID: userID, + WantMembership: "join", + }, &queryRes) + if err != nil { + log.WithError(err).Error("failed to calculate joined rooms for user") + return true + } + presence := msg.Header.Get("presence") ts, err := strconv.Atoi(msg.Header.Get("last_active_ts")) @@ -96,11 +110,13 @@ func (t *OutputPresenceConsumer) onMessage(ctx context.Context, msgs []*nats.Msg return true } - joined, err := t.db.GetAllJoinedHosts(ctx) + // send this presence to all servers who share rooms with this user. + joined, err := t.db.GetJoinedHostsForRooms(t.ctx, queryRes.RoomIDs, true) if err != nil { log.WithError(err).Error("failed to get joined hosts") return true } + if len(joined) == 0 { return true } diff --git a/federationapi/federationapi.go b/federationapi/federationapi.go index a58cba1b1..202da6c51 100644 --- a/federationapi/federationapi.go +++ b/federationapi/federationapi.go @@ -164,7 +164,7 @@ func NewInternalAPI( } presenceConsumer := consumers.NewOutputPresenceConsumer( - base.ProcessContext, cfg, js, queues, federationDB, + base.ProcessContext, cfg, js, queues, federationDB, rsAPI, ) if err = presenceConsumer.Start(); err != nil { logrus.WithError(err).Panic("failed to start presence consumer") diff --git a/internal/version.go b/internal/version.go index f762adf90..85b19046e 100644 --- a/internal/version.go +++ b/internal/version.go @@ -17,7 +17,7 @@ var build string const ( VersionMajor = 0 VersionMinor = 10 - VersionPatch = 6 + VersionPatch = 7 VersionTag = "" // example: "rc1" ) diff --git a/syncapi/streams/stream_pdu.go b/syncapi/streams/stream_pdu.go index b21be6c5e..65ca8e2a3 100644 --- a/syncapi/streams/stream_pdu.go +++ b/syncapi/streams/stream_pdu.go @@ -264,6 +264,9 @@ func (p *PDUStreamProvider) addRoomDeltaToResponse( // Work out what the highest stream position is for all of the events in this // room that were returned. latestPosition := r.To + if r.Backwards { + latestPosition = r.From + } updateLatestPosition := func(mostRecentEventID string) { var pos types.StreamPosition if _, pos, err = snapshot.PositionInTopology(ctx, mostRecentEventID); err == nil { diff --git a/sytest-blacklist b/sytest-blacklist index daa4c0442..1dd67cc8f 100644 --- a/sytest-blacklist +++ b/sytest-blacklist @@ -47,7 +47,5 @@ If a device list update goes missing, the server resyncs on the next one Leaves are present in non-gapped incremental syncs -# Fails due to fix / workaround for this issue https://github.com/matrix-org/dendrite/issues/2842 - -Newly joined room is included in an incremental sync -Newly joined room is included in an incremental sync after invite \ No newline at end of file +# Below test was passing for the wrong reason, failing correctly since #2858 +New federated private chats get full presence information (SYN-115) diff --git a/sytest-whitelist b/sytest-whitelist index c9cffb07c..0a6b3f270 100644 --- a/sytest-whitelist +++ b/sytest-whitelist @@ -680,7 +680,6 @@ Presence changes are reported to local room members Presence changes are also reported to remote room members Presence changes to UNAVAILABLE are reported to local room members Presence changes to UNAVAILABLE are reported to remote room members -New federated private chats get full presence information (SYN-115) /upgrade copies >100 power levels to the new room Room state after a rejected message event is the same as before Room state after a rejected state event is the same as before