mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
people: Rename ProfileData type to singular ProfileDatum.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Anders Kaseorg
parent
ec199082fd
commit
a01d68e838
@@ -18,7 +18,7 @@ import * as timerender from "./timerender";
|
|||||||
import {user_settings} from "./user_settings";
|
import {user_settings} from "./user_settings";
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
|
|
||||||
export type ProfileData = {
|
export type ProfileDatum = {
|
||||||
value: string;
|
value: string;
|
||||||
rendered_value?: string | undefined;
|
rendered_value?: string | undefined;
|
||||||
};
|
};
|
||||||
@@ -41,7 +41,7 @@ export type User = {
|
|||||||
timezone: string;
|
timezone: string;
|
||||||
avatar_url?: string | null;
|
avatar_url?: string | null;
|
||||||
avatar_version: number;
|
avatar_version: number;
|
||||||
profile_data: Record<number, ProfileData>;
|
profile_data: Record<number, ProfileDatum>;
|
||||||
// used for fake user objects.
|
// used for fake user objects.
|
||||||
is_missing_server_data?: boolean;
|
is_missing_server_data?: boolean;
|
||||||
// used for inaccessible user objects.
|
// used for inaccessible user objects.
|
||||||
@@ -1660,7 +1660,7 @@ export function set_full_name(person_obj: User, new_full_name: string): void {
|
|||||||
|
|
||||||
export function set_custom_profile_field_data(
|
export function set_custom_profile_field_data(
|
||||||
user_id: number,
|
user_id: number,
|
||||||
field: {id: number} & ProfileData,
|
field: {id: number} & ProfileDatum,
|
||||||
): void {
|
): void {
|
||||||
if (field.id === undefined) {
|
if (field.id === undefined) {
|
||||||
blueslip.error("Trying to set undefined field id");
|
blueslip.error("Trying to set undefined field id");
|
||||||
@@ -1699,7 +1699,7 @@ export function my_current_user_id(): number {
|
|||||||
return my_user_id;
|
return my_user_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function my_custom_profile_data(field_id: number): ProfileData | null | undefined {
|
export function my_custom_profile_data(field_id: number): ProfileDatum | null | undefined {
|
||||||
if (field_id === undefined) {
|
if (field_id === undefined) {
|
||||||
blueslip.error("Undefined field id");
|
blueslip.error("Undefined field id");
|
||||||
return undefined;
|
return undefined;
|
||||||
@@ -1710,7 +1710,7 @@ export function my_custom_profile_data(field_id: number): ProfileData | null | u
|
|||||||
export function get_custom_profile_data(
|
export function get_custom_profile_data(
|
||||||
user_id: number,
|
user_id: number,
|
||||||
field_id: number,
|
field_id: number,
|
||||||
): ProfileData | null | undefined {
|
): ProfileDatum | null | undefined {
|
||||||
const person = get_by_user_id(user_id);
|
const person = get_by_user_id(user_id);
|
||||||
const profile_data = person.profile_data;
|
const profile_data = person.profile_data;
|
||||||
if (profile_data === undefined) {
|
if (profile_data === undefined) {
|
||||||
@@ -1722,13 +1722,13 @@ export function get_custom_profile_data(
|
|||||||
export function get_custom_fields_by_type(
|
export function get_custom_fields_by_type(
|
||||||
user_id: number,
|
user_id: number,
|
||||||
field_type: number,
|
field_type: number,
|
||||||
): ProfileData[] | null {
|
): ProfileDatum[] | null {
|
||||||
const person = get_by_user_id(user_id);
|
const person = get_by_user_id(user_id);
|
||||||
const profile_data = person.profile_data;
|
const profile_data = person.profile_data;
|
||||||
if (profile_data === undefined) {
|
if (profile_data === undefined) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const filteredProfileData: ProfileData[] = [];
|
const filteredProfileData: ProfileDatum[] = [];
|
||||||
for (const field of realm.custom_profile_fields) {
|
for (const field of realm.custom_profile_fields) {
|
||||||
if (field.type === field_type) {
|
if (field.type === field_type) {
|
||||||
filteredProfileData.push(profile_data[field.id]);
|
filteredProfileData.push(profile_data[field.id]);
|
||||||
|
|||||||
Reference in New Issue
Block a user