From abf67a16aeefbb2d8c6968f694438d18333b0287 Mon Sep 17 00:00:00 2001 From: Changaco Date: Mon, 29 Oct 2018 10:21:35 +0100 Subject: [PATCH] stop storing Twitter account IDs twice --- liberapay/elsewhere/twitter.py | 5 +++-- sql/branch.sql | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/liberapay/elsewhere/twitter.py b/liberapay/elsewhere/twitter.py index 8cbe48e227..e261b14ad1 100644 --- a/liberapay/elsewhere/twitter.py +++ b/liberapay/elsewhere/twitter.py @@ -1,7 +1,7 @@ from __future__ import absolute_import, division, print_function, unicode_literals from liberapay.elsewhere._base import PlatformOAuth1 -from liberapay.elsewhere._extractors import key, not_available +from liberapay.elsewhere._extractors import drop_keys, key, not_available from liberapay.elsewhere._paginators import query_param_paginator @@ -29,7 +29,7 @@ class Twitter(PlatformOAuth1): ratelimit_headers_prefix = 'x-rate-limit-' # User info extractors - x_user_id = key('id') + x_user_id = key('id_str') x_user_name = key('screen_name') x_display_name = key('name') x_email = not_available @@ -37,3 +37,4 @@ class Twitter(PlatformOAuth1): clean=lambda v: v.replace('_normal.', '.')) x_friends_count = key('friends_count') x_description = key('description') + x_extra_info_drop = drop_keys('id') diff --git a/sql/branch.sql b/sql/branch.sql index 4df69d6e97..0c984dac38 100644 --- a/sql/branch.sql +++ b/sql/branch.sql @@ -10,7 +10,7 @@ UPDATE elsewhere AND json_typeof(extra_info) = 'object'; UPDATE elsewhere - SET extra_info = (extra_info::jsonb - 'entities' - 'status')::json + SET extra_info = (extra_info::jsonb - 'id_str' - 'entities' - 'status')::json WHERE platform = 'twitter' AND json_typeof(extra_info) = 'object';