Skip to content

Commit 930d9d7

Browse files
committed
CustomProfileFields: Use styled UserItem for (unknown user)
Since zulip#5790 last month, UserItem has been prepared to gracefully handle users we don't know about. Use that, instead of special-casing with a plain ZulipTextIntl, which we'd been doing since 2022-06 (0a10831) when CustomProfileFields was added. The change won't be visible unless a given user object is actually absent; that'll start happening when we do zulip#5808. See screenshots: zulip#5809 (comment)
1 parent ecfd8d4 commit 930d9d7

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

src/account-info/CustomProfileFields.js

-9
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,21 @@ import { View } from 'react-native';
55
import { type UserOrBot, type UserId } from '../api/modelTypes';
66
import WebLink from '../common/WebLink';
77
import ZulipText from '../common/ZulipText';
8-
import ZulipTextIntl from '../common/ZulipTextIntl';
98
import { ensureUnreachable } from '../generics';
109
import { useSelector } from '../react-redux';
11-
import { tryGetUserForId } from '../selectors';
1210
import {
1311
type CustomProfileFieldValue,
1412
getCustomProfileFieldsForUser,
1513
} from '../users/userSelectors';
1614
import UserItem from '../users/UserItem';
1715
import { useNavigation } from '../react-navigation';
1816

19-
/* eslint-disable no-shadow */
20-
2117
type Props = {|
2218
+user: UserOrBot,
2319
|};
2420

2521
function CustomProfileFieldUser(props: {| +userId: UserId |}): React.Node {
2622
const { userId } = props;
27-
const user = useSelector(state => tryGetUserForId(state, userId));
2823

2924
const navigation = useNavigation();
3025
const onPress = React.useCallback(
@@ -34,10 +29,6 @@ function CustomProfileFieldUser(props: {| +userId: UserId |}): React.Node {
3429
[navigation],
3530
);
3631

37-
if (!user) {
38-
return <ZulipTextIntl text="(unknown user)" />;
39-
}
40-
4132
return <UserItem userId={userId} onPress={onPress} size="medium" />;
4233
}
4334

0 commit comments

Comments
 (0)