Dependency inject ApplicationServiceApi when creating ApplicationServicesHandler.
2 files changed, 6 insertions, 4 deletions
diff --git a/synapse/handlers/__init__.py b/synapse/handlers/__init__.py
index b31518bf62..8d345bf936 100644
--- a/synapse/handlers/__init__.py
+++ b/synapse/handlers/__init__.py
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from synapse.appservice.api import ApplicationServiceApi
from .register import RegistrationHandler
from .room import (
RoomCreationHandler, RoomMemberHandler, RoomListHandler
@@ -53,5 +54,7 @@ class Handlers(object):
self.directory_handler = DirectoryHandler(hs)
self.typing_notification_handler = TypingNotificationHandler(hs)
self.admin_handler = AdminHandler(hs)
- self.appservice_handler = ApplicationServicesHandler(hs)
+ self.appservice_handler = ApplicationServicesHandler(
+ hs, ApplicationServiceApi(hs)
+ )
self.sync_handler = SyncHandler(hs)
diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py
index 8d0cdd528c..fa810b9a98 100644
--- a/synapse/handlers/appservice.py
+++ b/synapse/handlers/appservice.py
@@ -18,7 +18,6 @@ from twisted.internet import defer
from synapse.api.constants import EventTypes
from synapse.api.errors import Codes, StoreError, SynapseError
from synapse.appservice import ApplicationService
-from synapse.appservice.api import ApplicationServiceApi
from synapse.types import UserID
import synapse.util.stringutils as stringutils
@@ -32,10 +31,10 @@ logger = logging.getLogger(__name__)
# easier.
class ApplicationServicesHandler(object):
- def __init__(self, hs):
+ def __init__(self, hs, appservice_api):
self.store = hs.get_datastore()
self.hs = hs
- self.appservice_api = ApplicationServiceApi(hs)
+ self.appservice_api = appservice_api
@defer.inlineCallbacks
def register(self, app_service):
|