mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-28 05:39:36 +03:00
Implement and test presence dropping of remote users
This commit is contained in:
parent
6fafa878f6
commit
83f031207e
2 changed files with 14 additions and 2 deletions
|
@ -463,9 +463,13 @@ class PresenceHandler(BaseHandler):
|
||||||
deferreds = []
|
deferreds = []
|
||||||
|
|
||||||
if target_user:
|
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]]
|
if user in self._remote_recvmap[u]]
|
||||||
remoteusers_by_domain = partition(remoteusers, lambda u: u.domain)
|
remoteusers_by_domain = partition(remoteusers, lambda u: u.domain)
|
||||||
|
|
||||||
|
|
|
@ -383,6 +383,14 @@ class PresenceInvitesTestCase(unittest.TestCase):
|
||||||
self.mock_stop.assert_called_with(
|
self.mock_stop.assert_called_with(
|
||||||
self.u_apple, target_user=self.u_banana)
|
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
|
@defer.inlineCallbacks
|
||||||
def test_get_presence_list(self):
|
def test_get_presence_list(self):
|
||||||
self.datastore.get_presence_list.return_value = defer.succeed(
|
self.datastore.get_presence_list.return_value = defer.succeed(
|
||||||
|
|
Loading…
Reference in a new issue