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
This commit is contained in:
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

View file

@ -86,6 +86,10 @@ class HttpPusher(object):
"'url' required in data for HTTP pusher"
)
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.data_minus_url = {}
self.data_minus_url.update(self.data)
@ -332,12 +336,7 @@ class HttpPusher(object):
if not notification_dict:
defer.returnValue([])
try:
url = self.url.replace(
"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)
resp = yield self.http_client.post_json_get_json(self.url, notification_dict)
except Exception:
logger.warn(
"Failed to push event %s to %s",