From bcd846d779a531f691607a00c61e469f5bce8739 Mon Sep 17 00:00:00 2001 From: Luna Date: Thu, 6 Dec 2018 01:25:39 -0300 Subject: [PATCH] user.settings: force jsonb conversion --- litecord/blueprints/user/settings.py | 6 +++++- litecord/gateway/websocket.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/litecord/blueprints/user/settings.py b/litecord/blueprints/user/settings.py index 399e5c5..64b081f 100644 --- a/litecord/blueprints/user/settings.py +++ b/litecord/blueprints/user/settings.py @@ -31,13 +31,17 @@ async def patch_current_settings(): for key in j: val = j[key] + jsonb_cnv = '' + # force postgres to update to jsonb + # when the fields ARE jsonb. if key in json_fields: val = json.dumps(val) + jsonb_cnv = '::jsonb' await app.db.execute(f""" UPDATE user_settings - SET {key}=$1 + SET {key}=$1{jsonb_cnv} WHERE id = $2 """, val, user_id) diff --git a/litecord/gateway/websocket.py b/litecord/gateway/websocket.py index 1697c04..3b2eb44 100644 --- a/litecord/gateway/websocket.py +++ b/litecord/gateway/websocket.py @@ -131,7 +131,7 @@ class GatewayWebsocket: if len(encoded) < 2048: log.debug('sending\n{}', pprint.pformat(payload)) else: - # log.debug('sending {}', pprint.pformat(payload)) + log.debug('sending {}', pprint.pformat(payload)) log.debug('sending op={} s={} t={} (too big)', payload.get('op'), payload.get('s'),