mirror of https://github.com/zulip/zulip.git
base_page_params: Update contributors schema in team_params_schema.
This commit is contained in:
parent
e7cc9090fd
commit
ab9b748ee3
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue