From 003a569974c70af3db7cb94f05821c8415d0fa26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Thu, 5 May 2022 09:51:48 +0200 Subject: [PATCH 1/7] Add changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- changelog.d/12636.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/12636.bugfix diff --git a/changelog.d/12636.bugfix b/changelog.d/12636.bugfix new file mode 100644 index 000000000000..4f6eba453cf3 --- /dev/null +++ b/changelog.d/12636.bugfix @@ -0,0 +1 @@ +Update `_on_new_receipts()` to work with [MSC2285](https://github.com/matrix-org/matrix-spec-proposals/pull/2285) changes. This was missed in https://github.com/matrix-org/synapse/pull/12168. From 3d09bef7f2e4aa3de8690257e7964d27c887f4d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Thu, 5 May 2022 09:50:02 +0200 Subject: [PATCH 2/7] Update `_on_new_receipts()` to work with MSC2285 changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was missed in https://github.com/matrix-org/synapse/pull/12168 Signed-off-by: Šimon Brandner --- synapse/replication/tcp/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synapse/replication/tcp/client.py b/synapse/replication/tcp/client.py index 122892c7bca2..4146b9147368 100644 --- a/synapse/replication/tcp/client.py +++ b/synapse/replication/tcp/client.py @@ -21,7 +21,7 @@ from twisted.internet.protocol import ReconnectingClientFactory from twisted.python.failure import Failure -from synapse.api.constants import EventTypes +from synapse.api.constants import EventTypes, ReceiptTypes from synapse.federation import send_queue from synapse.federation.sender import FederationSender from synapse.logging.context import PreserveLoggingContext, make_deferred_yieldable @@ -402,7 +402,7 @@ async def _on_new_receipts( if not self._is_mine_id(receipt.user_id): continue if ( - receipt.data.get("hidden", False) + receipt.receipt_type == ReceiptTypes.READ_PRIVATE and self._hs.config.experimental.msc2285_enabled ): continue From a5dc2d6f4982010dc55d56970de0a55655cda80f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Thu, 5 May 2022 14:07:30 +0200 Subject: [PATCH 3/7] Match changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- changelog.d/12635.feature | 1 + changelog.d/12636.bugfix | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 changelog.d/12635.feature delete mode 100644 changelog.d/12636.bugfix diff --git a/changelog.d/12635.feature b/changelog.d/12635.feature new file mode 100644 index 000000000000..cd5c45029ee1 --- /dev/null +++ b/changelog.d/12635.feature @@ -0,0 +1 @@ +Implement [changes](https://github.com/matrix-org/matrix-spec-proposals/pull/2285/commits/4a77139249c2e830aec3c7d6bd5501a514d1cc27) to [MSC2285 (hidden read receipts)](https://github.com/matrix-org/matrix-spec-proposals/pull/2285). Contributed by @SimonBrandner. diff --git a/changelog.d/12636.bugfix b/changelog.d/12636.bugfix deleted file mode 100644 index 4f6eba453cf3..000000000000 --- a/changelog.d/12636.bugfix +++ /dev/null @@ -1 +0,0 @@ -Update `_on_new_receipts()` to work with [MSC2285](https://github.com/matrix-org/matrix-spec-proposals/pull/2285) changes. This was missed in https://github.com/matrix-org/synapse/pull/12168. From 5d9fc6b0761eaca728ec891636c6e382f13d920c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Thu, 5 May 2022 14:30:40 +0200 Subject: [PATCH 4/7] Fix changelog number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- changelog.d/{12635.feature => 12636.feature} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/{12635.feature => 12636.feature} (100%) diff --git a/changelog.d/12635.feature b/changelog.d/12636.feature similarity index 100% rename from changelog.d/12635.feature rename to changelog.d/12636.feature From 69b42f7638555646dc5f30354b37d7abae73c691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Thu, 5 May 2022 14:52:01 +0200 Subject: [PATCH 5/7] Never send out private receipts no matter what MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- synapse/replication/tcp/client.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/synapse/replication/tcp/client.py b/synapse/replication/tcp/client.py index 4146b9147368..3a32ec17b748 100644 --- a/synapse/replication/tcp/client.py +++ b/synapse/replication/tcp/client.py @@ -401,10 +401,7 @@ async def _on_new_receipts( # we only want to send on receipts for our own users if not self._is_mine_id(receipt.user_id): continue - if ( - receipt.receipt_type == ReceiptTypes.READ_PRIVATE - and self._hs.config.experimental.msc2285_enabled - ): + if (receipt.receipt_type == ReceiptTypes.READ_PRIVATE): continue receipt_info = ReadReceipt( receipt.room_id, From 51d5bbe075a891a4b865229e53dc5371ce1d9fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Thu, 5 May 2022 14:56:23 +0200 Subject: [PATCH 6/7] Delint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- synapse/replication/tcp/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/replication/tcp/client.py b/synapse/replication/tcp/client.py index 3a32ec17b748..0bac9508f8ed 100644 --- a/synapse/replication/tcp/client.py +++ b/synapse/replication/tcp/client.py @@ -401,7 +401,7 @@ async def _on_new_receipts( # we only want to send on receipts for our own users if not self._is_mine_id(receipt.user_id): continue - if (receipt.receipt_type == ReceiptTypes.READ_PRIVATE): + if receipt.receipt_type == ReceiptTypes.READ_PRIVATE: continue receipt_info = ReadReceipt( receipt.room_id, From b2add74bfcf62ed81e2ed307fc53a1b82b8a7bb2 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Thu, 5 May 2022 09:00:42 -0400 Subject: [PATCH 7/7] Add a comment. --- synapse/replication/tcp/client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/synapse/replication/tcp/client.py b/synapse/replication/tcp/client.py index 0bac9508f8ed..350762f49447 100644 --- a/synapse/replication/tcp/client.py +++ b/synapse/replication/tcp/client.py @@ -401,6 +401,7 @@ async def _on_new_receipts( # we only want to send on receipts for our own users if not self._is_mine_id(receipt.user_id): continue + # Private read receipts never get sent over federation. if receipt.receipt_type == ReceiptTypes.READ_PRIVATE: continue receipt_info = ReadReceipt(