push_notifications: Clear PushDeviceToken on API key change.

Backported for 2.0.7 security release.

This includes adding a new endpoint to the push notification bouncer
interface, and code to call it appropriately after resetting a user's
personal API key.

When we add support for a user having multiple API keys, we may need
to add an additional key here to support removing keys associated with
just one client.
This commit is contained in:
Tim Abbott
2019-11-18 18:12:54 -08:00
parent bccec80062
commit c47039dfb6
6 changed files with 69 additions and 2 deletions

View File

@@ -3205,6 +3205,10 @@ def do_regenerate_api_key(user_profile: UserProfile, acting_user: UserProfile) -
)),
bot_owner_user_ids(user_profile))
event = {'type': 'clear_push_device_tokens',
'user_profile_id': user_profile.id}
queue_json_publish("deferred_work", event)
def do_change_avatar_fields(user_profile: UserProfile, avatar_source: str) -> None:
user_profile.avatar_source = avatar_source
user_profile.avatar_version += 1