Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
base_page_params: Update contributors schema in team_params_schema.
afeefuddinab9b748ee3af
diff --git a/web/src/base_page_params.ts b/web/src/base_page_params.tsindex 81797da23b1..bd163cd5687 100644--- a/web/src/base_page_params.ts+++ b/web/src/base_page_params.ts@@ -72,7 +72,21 @@ const stats_params_schema = default_params_schema.extend({// Sync this with corporate.views.portico.team_view.const team_params_schema = default_params_schema.extend({page_type: z.literal("team"),- contributors: z.unknown(),+ contributors: z.optional(+ z.array(+ z+ .object({+ avatar: z.string(),+ github_username: z.optional(z.string()),+ email: z.optional(z.string()),+ name: z.optional(z.string()),+ })+ // Repository names may change or increase over time,+ // so we use this to parse the contributions of the user in+ // the given repository instead of typing every name.+ .catchall(z.number()),+ ),+ ),});// Sync this with corporate.lib.stripe.UpgradePageParams.diff --git a/web/src/portico/team.ts b/web/src/portico/team.tsindex db61d045e1c..55e6e512cd7 100644--- a/web/src/portico/team.ts+++ b/web/src/portico/team.ts@@ -1,5 +1,6 @@import $ from "jquery";import _ from "lodash";+import assert from "minimalistic-assert";// The list of repository names is duplicated here in order to provide// a clear type for Contributor objects.@@ -70,17 +71,17 @@ const tab_name_to_repo_list: Record<TabName, RepositoryName[]> = {export type Contributor = {avatar: string;- email?: string;- github_username?: string;- name: string;+ email?: string | undefined;+ github_username?: string | undefined;+ name?: string | undefined;} & {[K in RepositoryName]?: number;};type ContributorData = {avatar: string;- email?: string;- github_username?: string;- name: string;+ email?: string | undefined;+ github_username?: string | undefined;+ name?: string | undefined;total_commits: number;};@@ -123,6 +124,7 @@ function get_display_name(contributor: Contributor): string {if (contributor.github_username) {return "@" + contributor.github_username;}+ assert(contributor.name !== undefined);return contributor.name;}