Skip to content

Commit

Permalink
stop storing Twitter account IDs twice
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Oct 29, 2018
1 parent 76d4a61 commit abf67a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions liberapay/elsewhere/twitter.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -29,11 +29,12 @@ 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
x_avatar_url = key('profile_image_url_https',
clean=lambda v: v.replace('_normal.', '.'))
x_friends_count = key('friends_count')
x_description = key('description')
x_extra_info_drop = drop_keys('id')
2 changes: 1 addition & 1 deletion sql/branch.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down

0 comments on commit abf67a1

Please sign in to comment.