mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-09-09 15:22:01 +00:00
Require device language when adding a pusher.
Because this seems like it might be useful to do sooner rather than later.
This commit is contained in:
parent
2ca2dbc821
commit
2d2953cf5f
@ -41,7 +41,7 @@ class PusherPool:
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def add_pusher(self, user_name, kind, app_id,
|
||||
app_display_name, device_display_name, pushkey, data):
|
||||
app_display_name, device_display_name, pushkey, lang, data):
|
||||
# we try to create the pusher just to validate the config: it
|
||||
# will then get pulled out of the database,
|
||||
# recreated, added and started: this means we have only one
|
||||
@ -54,6 +54,7 @@ class PusherPool:
|
||||
"device_display_name": device_display_name,
|
||||
"pushkey": pushkey,
|
||||
"pushkey_ts": self.hs.get_clock().time_msec(),
|
||||
"lang": lang,
|
||||
"data": data,
|
||||
"last_token": None,
|
||||
"last_success": None,
|
||||
@ -62,13 +63,13 @@ class PusherPool:
|
||||
yield self._add_pusher_to_store(
|
||||
user_name, kind, app_id,
|
||||
app_display_name, device_display_name,
|
||||
pushkey, data
|
||||
pushkey, lang, data
|
||||
)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def _add_pusher_to_store(self, user_name, kind, app_id,
|
||||
app_display_name, device_display_name,
|
||||
pushkey, data):
|
||||
pushkey, lang, data):
|
||||
yield self.store.add_pusher(
|
||||
user_name=user_name,
|
||||
kind=kind,
|
||||
@ -77,6 +78,7 @@ class PusherPool:
|
||||
device_display_name=device_display_name,
|
||||
pushkey=pushkey,
|
||||
pushkey_ts=self.hs.get_clock().time_msec(),
|
||||
lang=lang,
|
||||
data=json.dumps(data)
|
||||
)
|
||||
self._refresh_pusher((app_id, pushkey))
|
||||
|
@ -32,7 +32,7 @@ class PusherRestServlet(RestServlet):
|
||||
content = _parse_json(request)
|
||||
|
||||
reqd = ['kind', 'app_id', 'app_display_name',
|
||||
'device_display_name', 'pushkey', 'data']
|
||||
'device_display_name', 'pushkey', 'lang', 'data']
|
||||
missing = []
|
||||
for i in reqd:
|
||||
if i not in content:
|
||||
@ -50,6 +50,7 @@ class PusherRestServlet(RestServlet):
|
||||
app_display_name=content['app_display_name'],
|
||||
device_display_name=content['device_display_name'],
|
||||
pushkey=content['pushkey'],
|
||||
lang=content['lang'],
|
||||
data=content['data']
|
||||
)
|
||||
except PusherConfigException as pce:
|
||||
|
@ -94,7 +94,7 @@ class PusherStore(SQLBaseStore):
|
||||
@defer.inlineCallbacks
|
||||
def add_pusher(self, user_name, kind, app_id,
|
||||
app_display_name, device_display_name,
|
||||
pushkey, pushkey_ts, data):
|
||||
pushkey, pushkey_ts, lang, data):
|
||||
try:
|
||||
yield self._simple_upsert(
|
||||
PushersTable.table_name,
|
||||
@ -108,6 +108,7 @@ class PusherStore(SQLBaseStore):
|
||||
app_display_name=app_display_name,
|
||||
device_display_name=device_display_name,
|
||||
ts=pushkey_ts,
|
||||
lang=lang,
|
||||
data=data
|
||||
))
|
||||
except Exception as e:
|
||||
|
@ -22,6 +22,7 @@ CREATE TABLE IF NOT EXISTS pushers (
|
||||
device_display_name varchar(128) NOT NULL,
|
||||
pushkey blob NOT NULL,
|
||||
ts BIGINT NOT NULL,
|
||||
lang varchar(8),
|
||||
data blob,
|
||||
last_token TEXT,
|
||||
last_success BIGINT,
|
||||
|
@ -22,6 +22,7 @@ CREATE TABLE IF NOT EXISTS pushers (
|
||||
device_display_name varchar(128) NOT NULL,
|
||||
pushkey blob NOT NULL,
|
||||
ts BIGINT NOT NULL,
|
||||
lang varchar(8),
|
||||
data blob,
|
||||
last_token TEXT,
|
||||
last_success BIGINT,
|
||||
|
Loading…
Reference in New Issue
Block a user