Merge branch 'develop' into application-services-registration-script

This commit is contained in:
Kegan Dougal 2015-04-01 10:19:17 +01:00
commit 9fa8bda099
3 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,10 @@
Changes in synapse vX
=====================
* Changed config option from ``disable_registration`` to
``enable_registration``. Old option will be ignored.
Changes in synapse v0.8.1 (2015-03-18) Changes in synapse v0.8.1 (2015-03-18)
====================================== ======================================

View File

@ -199,7 +199,10 @@ class ApplicationService(object):
return self._matches_user(event, member_list) return self._matches_user(event, member_list)
def is_interested_in_user(self, user_id): def is_interested_in_user(self, user_id):
return self._matches_regex(user_id, ApplicationService.NS_USERS) return (
self._matches_regex(user_id, ApplicationService.NS_USERS)
or user_id == self.sender
)
def is_interested_in_alias(self, alias): def is_interested_in_alias(self, alias):
return self._matches_regex(alias, ApplicationService.NS_ALIASES) return self._matches_regex(alias, ApplicationService.NS_ALIASES)

View File

@ -199,6 +199,19 @@ class ApplicationServiceTestCase(unittest.TestCase):
aliases_for_event=["#xmpp_barfoo:matrix.org"] aliases_for_event=["#xmpp_barfoo:matrix.org"]
)) ))
def test_interested_in_self(self):
# make sure invites get through
self.service.sender = "@appservice:name"
self.service.namespaces[ApplicationService.NS_USERS].append(
_regex("@irc_.*")
)
self.event.type = "m.room.member"
self.event.content = {
"membership": "invite"
}
self.event.state_key = self.service.sender
self.assertTrue(self.service.is_interested(self.event))
def test_member_list_match(self): def test_member_list_match(self):
self.service.namespaces[ApplicationService.NS_USERS].append( self.service.namespaces[ApplicationService.NS_USERS].append(
_regex("@irc_.*") _regex("@irc_.*")