diff options
Diffstat (limited to '')
-rw-r--r-- | synapse/handlers/presence.py | 8 | ||||
-rw-r--r-- | tests/handlers/test_presence.py | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index e8cb83eddb..73ec45c9cb 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -463,9 +463,13 @@ class PresenceHandler(BaseHandler): deferreds = [] if target_user: - raise NotImplementedError("TODO: remove one user") + if target_user not in self._remote_recvmap: + return + target_users = set([target_user]) + else: + target_users = self._remote_recvmap.keys() - remoteusers = [u for u in self._remote_recvmap + remoteusers = [u for u in target_users if user in self._remote_recvmap[u]] remoteusers_by_domain = partition(remoteusers, lambda u: u.domain) diff --git a/tests/handlers/test_presence.py b/tests/handlers/test_presence.py index 86bd8bb3f2..a1856e46e2 100644 --- a/tests/handlers/test_presence.py +++ b/tests/handlers/test_presence.py @@ -384,6 +384,14 @@ class PresenceInvitesTestCase(unittest.TestCase): self.u_apple, target_user=self.u_banana) @defer.inlineCallbacks + def test_drop_remote(self): + yield self.handler.drop( + observer_user=self.u_apple, observed_user=self.u_cabbage) + + self.datastore.del_presence_list.assert_called_with( + "apple", "@cabbage:elsewhere") + + @defer.inlineCallbacks def test_get_presence_list(self): self.datastore.get_presence_list.return_value = defer.succeed( [{"observed_user_id": "@banana:test"}] |