invites: Send user_id of the referrer instead of email in invites dict.

We send user_id of the referrer instead of email in the invites dict.
Sending user_ids is more robust, as those are an immutable reference
to a user, rather than something that can change with time.

Updates to the webapp UI to display the inviters for more convenient
inspection will come in a future commit.
This commit is contained in:
sahil839
2020-06-27 00:56:57 +05:30
committed by Tim Abbott
parent dc05b5c317
commit 6eb8442a59
6 changed files with 23 additions and 14 deletions

View File

@@ -5282,7 +5282,7 @@ def do_get_user_invites(user_profile: UserProfile) -> List[Dict[str, Any]]:
for invitee in prereg_users:
invites.append(dict(email=invitee.email,
ref=invitee.referred_by.email,
invited_by_user_id=invitee.referred_by.id,
invited=datetime_to_timestamp(invitee.invited_at),
id=invitee.id,
invited_as=invitee.invited_as,
@@ -5298,7 +5298,7 @@ def do_get_user_invites(user_profile: UserProfile) -> List[Dict[str, Any]]:
date_sent__gte=lowest_datetime)
for confirmation_obj in multiuse_confirmation_objs:
invite = confirmation_obj.content_object
invites.append(dict(ref=invite.referred_by.email,
invites.append(dict(invited_by_user_id=invite.referred_by.id,
invited=datetime_to_timestamp(confirmation_obj.date_sent),
id=invite.id,
link_url=confirmation_url(confirmation_obj.confirmation_key,