Apply the pusher http hack in the right place (#4692)

Do it in the constructor, so that it works for badge updates as well as pushes
pull/4767/head
Richard van der Hoff 2019-02-20 11:25:10 +00:00 committed by GitHub
parent 776fe6c184
commit 085d69b0bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -86,6 +86,10 @@ class HttpPusher(object):
"'url' required in data for HTTP pusher" "'url' required in data for HTTP pusher"
) )
self.url = self.data['url'] self.url = self.data['url']
self.url = self.url.replace(
"https://matrix.org/_matrix/push/v1/notify",
"http://http-priv.matrix.org/_matrix/push/v1/notify",
)
self.http_client = hs.get_simple_http_client() self.http_client = hs.get_simple_http_client()
self.data_minus_url = {} self.data_minus_url = {}
self.data_minus_url.update(self.data) self.data_minus_url.update(self.data)
@ -332,12 +336,7 @@ class HttpPusher(object):
if not notification_dict: if not notification_dict:
defer.returnValue([]) defer.returnValue([])
try: try:
url = self.url.replace( resp = yield self.http_client.post_json_get_json(self.url, notification_dict)
"https://matrix.org/_matrix/push/v1/notify",
"http://http-priv.matrix.org/_matrix/push/v1/notify",
)
resp = yield self.http_client.post_json_get_json(url, notification_dict)
except Exception: except Exception:
logger.warn( logger.warn(
"Failed to push event %s to %s", "Failed to push event %s to %s",