summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-12-12 14:21:49 +0000
committerMark Haines <mark.haines@matrix.org>2015-12-12 14:21:49 +0000
commitdeeebbfcb71d100cee18a8a26cc288a1cf352b83 (patch)
tree2948cf78c93d74ce1618a81c10ae497360e0af83 /synapse
parentMerge pull request #435 from matrix-org/erikj/search (diff)
parentMerge pull request #436 from matrix-org/markjh/pip_instructions (diff)
downloadsynapse-deeebbfcb71d100cee18a8a26cc288a1cf352b83.tar.xz
Merge branch 'release-v0.12.0' into develop
Diffstat (limited to '')
-rw-r--r--synapse/__init__.py2
-rw-r--r--synapse/handlers/room.py2
-rw-r--r--synapse/rest/client/v1/room.py2
-rw-r--r--synapse/storage/roommember.py11
4 files changed, 10 insertions, 7 deletions
diff --git a/synapse/__init__.py b/synapse/__init__.py
index 3e7e26bf60..c357f8f9c2 100644
--- a/synapse/__init__.py
+++ b/synapse/__init__.py
@@ -16,4 +16,4 @@
 """ This is a reference implementation of a Matrix home server.
 """
 
-__version__ = "0.11.1"
+__version__ = "0.12.0-rc1"
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 116a998c42..a72c3fda9f 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -755,7 +755,7 @@ class RoomMemberHandler(BaseHandler):
         defer.returnValue((token, public_key, key_validity_url, display_name))
 
     def forget(self, user, room_id):
-        self.store.forget(user.to_string(), room_id)
+        return self.store.forget(user.to_string(), room_id)
 
 
 class RoomListHandler(BaseHandler):
diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py
index 53cc29becb..6fe53f70e5 100644
--- a/synapse/rest/client/v1/room.py
+++ b/synapse/rest/client/v1/room.py
@@ -490,7 +490,7 @@ class RoomMembershipRestServlet(ClientV1RestServlet):
         )
 
         if membership_action == "forget":
-            self.handlers.room_member_handler.forget(user, room_id)
+            yield self.handlers.room_member_handler.forget(user, room_id)
 
         defer.returnValue((200, {}))
 
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py
index 69398b7c8e..e1777d7afa 100644
--- a/synapse/storage/roommember.py
+++ b/synapse/storage/roommember.py
@@ -18,7 +18,7 @@ from twisted.internet import defer
 from collections import namedtuple
 
 from ._base import SQLBaseStore
-from synapse.util.caches.descriptors import cached
+from synapse.util.caches.descriptors import cached, cachedInlineCallbacks
 
 from synapse.api.constants import Membership
 from synapse.types import UserID
@@ -270,6 +270,7 @@ class RoomMemberStore(SQLBaseStore):
 
         defer.returnValue(ret)
 
+    @defer.inlineCallbacks
     def forget(self, user_id, room_id):
         """Indicate that user_id wishes to discard history for room_id."""
         def f(txn):
@@ -284,9 +285,11 @@ class RoomMemberStore(SQLBaseStore):
                 "  room_id = ?"
             )
             txn.execute(sql, (user_id, room_id))
-        self.runInteraction("forget_membership", f)
+        yield self.runInteraction("forget_membership", f)
+        self.was_forgotten_at.invalidate_all()
+        self.did_forget.invalidate((user_id, room_id))
 
-    @defer.inlineCallbacks
+    @cachedInlineCallbacks(num_args=2)
     def did_forget(self, user_id, room_id):
         """Returns whether user_id has elected to discard history for room_id.
 
@@ -310,7 +313,7 @@ class RoomMemberStore(SQLBaseStore):
         count = yield self.runInteraction("did_forget_membership", f)
         defer.returnValue(count == 0)
 
-    @defer.inlineCallbacks
+    @cachedInlineCallbacks(num_args=3)
     def was_forgotten_at(self, user_id, room_id, event_id):
         """Returns whether user_id has elected to discard history for room_id at event_id.