summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorTravis Ralston <travpc@gmail.com>2019-09-05 20:37:58 -0600
committerTravis Ralston <travpc@gmail.com>2019-09-05 20:37:58 -0600
commitaab3f5d11e95868dd4b8bb4989256d88d6ce6635 (patch)
treec851e53ebad4a13ffe32ceb6767afef06421cc86 /synapse
parentTrace how long it takes for the send trasaction to complete, including retrys... (diff)
downloadsynapse-aab3f5d11e95868dd4b8bb4989256d88d6ce6635.tar.xz
Support optionally not sending read receipts to other users/servers
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/receipts.py5
-rw-r--r--synapse/rest/client/v2_alpha/read_marker.py1
-rw-r--r--synapse/rest/client/v2_alpha/receipts.py8
3 files changed, 11 insertions, 3 deletions
diff --git a/synapse/handlers/receipts.py b/synapse/handlers/receipts.py
index 6854c751a6..e3f20622fb 100644
--- a/synapse/handlers/receipts.py
+++ b/synapse/handlers/receipts.py
@@ -106,7 +106,7 @@ class ReceiptsHandler(BaseHandler):
         return True
 
     @defer.inlineCallbacks
-    def received_client_receipt(self, room_id, receipt_type, user_id, event_id):
+    def received_client_receipt(self, room_id, receipt_type, user_id, event_id, hidden):
         """Called when a client tells us a local user has read up to the given
         event_id in the room.
         """
@@ -122,7 +122,8 @@ class ReceiptsHandler(BaseHandler):
         if not is_new:
             return
 
-        yield self.federation.send_read_receipt(receipt)
+        if not hidden:
+            yield self.federation.send_read_receipt(receipt)
 
     @defer.inlineCallbacks
     def get_receipts_for_room(self, room_id, to_key):
diff --git a/synapse/rest/client/v2_alpha/read_marker.py b/synapse/rest/client/v2_alpha/read_marker.py
index b3bf8567e1..bd5c4e5a30 100644
--- a/synapse/rest/client/v2_alpha/read_marker.py
+++ b/synapse/rest/client/v2_alpha/read_marker.py
@@ -49,6 +49,7 @@ class ReadMarkerRestServlet(RestServlet):
                 "m.read",
                 user_id=requester.user.to_string(),
                 event_id=read_event_id,
+                hidden=body.get("m.hidden", False),
             )
 
         read_marker_event_id = body.get("m.fully_read", None)
diff --git a/synapse/rest/client/v2_alpha/receipts.py b/synapse/rest/client/v2_alpha/receipts.py
index 0dab03d227..073e3d95c8 100644
--- a/synapse/rest/client/v2_alpha/receipts.py
+++ b/synapse/rest/client/v2_alpha/receipts.py
@@ -46,10 +46,16 @@ class ReceiptRestServlet(RestServlet):
         if receipt_type != "m.read":
             raise SynapseError(400, "Receipt type must be 'm.read'")
 
+        body = parse_json_object_from_request(request)
+
         yield self.presence_handler.bump_presence_active_time(requester.user)
 
         yield self.receipts_handler.received_client_receipt(
-            room_id, receipt_type, user_id=requester.user.to_string(), event_id=event_id
+            room_id,
+            receipt_type,
+            user_id=requester.user.to_string(),
+            event_id=event_id,
+            hidden=body.get("m.hidden", False),
         )
 
         return 200, {}