push_notifications: Send user_uuid to the push bouncer.

Fixes #18017.

In previous commits, the change to the bouncer API was introduced to
support this and then a series of migrations added .uuid to
UserProfiles.

Now the code for self-hosted servers that makes requests
to the bouncer is changed to make use of it.
This commit is contained in:
Mateusz Mandera
2022-02-23 20:27:39 +01:00
committed by Tim Abbott
parent c3209d379c
commit d800ac33a0
3 changed files with 59 additions and 20 deletions

View File

@@ -976,12 +976,19 @@ def add_user_profile_child_configs(user_profile_config: Config) -> None:
)
# We exclude these fields for the following reasons:
# * api_key is a secret.
# * password is a secret.
# * uuid is unlikely to be useful if the domain changes.
EXCLUDED_USER_PROFILE_FIELDS = ["api_key", "password", "uuid"]
def custom_fetch_user_profile(response: TableData, context: Context) -> None:
realm = context["realm"]
exportable_user_ids = context["exportable_user_ids"]
query = UserProfile.objects.filter(realm_id=realm.id)
exclude = ["password", "api_key"]
exclude = EXCLUDED_USER_PROFILE_FIELDS
rows = make_raw(list(query), exclude=exclude)
normal_rows: List[Record] = []
@@ -1979,7 +1986,7 @@ def get_single_user_config() -> Config:
user_profile_config = Config(
table="zerver_userprofile",
is_seeded=True,
exclude=["password", "api_key"],
exclude=EXCLUDED_USER_PROFILE_FIELDS,
)
# zerver_subscription