Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
invites: Send user_id of the referrer instead of email in invites dict.
sahil8396eb8442a59e1
diff --git a/static/js/settings_invites.js b/static/js/settings_invites.jsindex 74b03ae91d4..a2024cec724 100644--- a/static/js/settings_invites.js+++ b/static/js/settings_invites.js@@ -48,12 +48,14 @@ function populate_invites(invites_data) {item.is_admin = page_params.is_admin;item.disable_buttons = item.invited_as === settings_config.user_role_values.owner.code&& !page_params.is_owner;+ item.referrer_email = people.get_by_user_id(item.invited_by_user_id).email;return render_admin_invites_list({ invite: item });},filter: {element: invites_table.closest(".settings-section").find(".search"),predicate: function (item, value) {- const referrer_email_matched = item.ref.toLowerCase().includes(value);+ const referrer_email = people.get_by_user_id(item.invited_by_user_id).email;+ const referrer_email_matched = referrer_email.toLowerCase().includes(value);if (item.is_multiuse) {return referrer_email_matched;}diff --git a/static/templates/admin_invites_list.hbs b/static/templates/admin_invites_list.hbsindex 2835573c09f..b059d69971a 100644--- a/static/templates/admin_invites_list.hbs+++ b/static/templates/admin_invites_list.hbs@@ -13,7 +13,7 @@</td>{{#if is_admin}}<td>- <span class="referred_by">{{ref}}</span>+ <span class="referred_by">{{referrer_email}}</span></td>{{/if}}<td>diff --git a/templates/zerver/api/changelog.md b/templates/zerver/api/changelog.mdindex f84c4292470..8e61ff297b8 100644--- a/templates/zerver/api/changelog.md+++ b/templates/zerver/api/changelog.md@@ -12,9 +12,15 @@ below features are supported.**Feature level 22**-* 'GET /attachments': Rename `name` to `date_sent` for clearer meaning- and change the data types of the new `date_sent` and `create_time`- to integer (previously the implementation could send floats).+* `GET /attachments`: The date when a message using the attachment was+ sent is now correctly encoded as `date_sent`, replacing the+ confusingly named `name` field. The `date_sent` and `create_time`+ fields of attachment objects are now encoded as integers;+ (previously the implementation could send floats incorrectly+ suggesting that microsecond precision is relevant).+* `GET /invites`: Now encodes the user ID of the person who created+ the invitation as `invited_by_user_id`, replacing the previous+ `ref` field (which had that user's Zulip display email address).**Feature level 21**diff --git a/version.py b/version.pyindex 699ee335b02..06d110658c1 100644--- a/version.py+++ b/version.py@@ -29,7 +29,7 @@ DESKTOP_WARNING_VERSION = "5.2.0"## Changes should be accompanied by documentation explaining what the# new level means in templates/zerver/api/changelog.md.-API_FEATURE_LEVEL = 21+API_FEATURE_LEVEL = 22# Bump the minor PROVISION_VERSION to indicate that folks should provision# only when going from an old version of the code to a newer version. Bumpdiff --git a/zerver/lib/actions.py b/zerver/lib/actions.pyindex 4864c69b4e8..2fde7f3031b 100644--- a/zerver/lib/actions.py+++ b/zerver/lib/actions.py@@ -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,diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.pyindex c6b21186230..6c6388b332e 100644--- a/zerver/tests/test_signup.py+++ b/zerver/tests/test_signup.py@@ -1664,12 +1664,13 @@ class InvitationsTestCase(InviteUserBase):result = self.client_get("/json/invites")self.assertEqual(result.status_code, 200)- self.assert_in_success_response(- ["[email protected]", hamlet.email],- result)- self.assert_not_in_success_response(- result)+ invites = ujson.loads(result.content)["invites"]+ self.assertEqual(len(invites), 2)++ self.assertFalse(invites[0]["is_multiuse"])+ self.assertEqual(invites[0]["email"], "[email protected]")+ self.assertTrue(invites[1]["is_multiuse"])+ self.assertEqual(invites[1]["invited_by_user_id"], hamlet.id)def test_successful_delete_invitation(self) -> None:"""