Skip to content

Commit b31750c

Browse files
committed
UserAvatarWithPresence: Convert all callers to use …ById instead
1 parent 662b122 commit b31750c

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

src/lightbox/Lightbox.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,8 @@ export default function Lightbox(props: Props): Node {
106106
navigation.dispatch(navigateBack());
107107
}}
108108
timestamp={message.timestamp}
109-
avatarUrl={message.avatar_url}
110109
senderName={message.sender_full_name}
111-
senderEmail={message.sender_email}
110+
senderId={message.sender_id}
112111
/>
113112
</View>
114113
<View

src/lightbox/LightboxHeader.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import { SafeAreaView } from 'react-native-safe-area-context';
66

77
import { shortTime, humanDate } from '../utils/date';
88
import { createStyleSheet } from '../styles';
9-
import UserAvatarWithPresence from '../common/UserAvatarWithPresence';
9+
import { UserAvatarWithPresenceById } from '../common/UserAvatarWithPresence';
1010
import { Icon } from '../common/Icons';
11-
import { AvatarURL } from '../utils/avatar';
1211
import { OfflineNoticePlaceholder } from '../boot/OfflineNoticeProvider';
12+
import type { UserId } from '../api/idTypes';
1313

1414
const styles = createStyleSheet({
1515
text: {
@@ -40,9 +40,8 @@ const styles = createStyleSheet({
4040

4141
type Props = $ReadOnly<{|
4242
senderName: string,
43-
senderEmail: string,
43+
senderId: UserId,
4444
timestamp: number,
45-
avatarUrl: AvatarURL,
4645
onPressBack: () => void,
4746
|}>;
4847

@@ -55,7 +54,7 @@ type Props = $ReadOnly<{|
5554
* @prop [onPressBack]
5655
*/
5756
export default function LightboxHeader(props: Props): Node {
58-
const { onPressBack, senderName, senderEmail, timestamp, avatarUrl } = props;
57+
const { onPressBack, senderName, senderId, timestamp } = props;
5958
const displayDate = humanDate(new Date(timestamp * 1000));
6059
const time = shortTime(new Date(timestamp * 1000));
6160
const subheader = `${displayDate} at ${time}`;
@@ -64,7 +63,7 @@ export default function LightboxHeader(props: Props): Node {
6463
<SafeAreaView mode="padding" edges={['top']}>
6564
<OfflineNoticePlaceholder />
6665
<SafeAreaView mode="padding" edges={['right', 'left']} style={styles.contentArea}>
67-
<UserAvatarWithPresence size={36} avatarUrl={avatarUrl} email={senderEmail} />
66+
<UserAvatarWithPresenceById size={36} userId={senderId} />
6867
<View style={styles.text}>
6968
<Text style={styles.name} numberOfLines={1}>
7069
{senderName}

src/user-picker/AvatarItem.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Animated, Easing, View } from 'react-native';
55
import type AnimatedValue from 'react-native/Libraries/Animated/nodes/AnimatedValue';
66

77
import type { UserId, UserOrBot } from '../types';
8-
import UserAvatarWithPresence from '../common/UserAvatarWithPresence';
8+
import { UserAvatarWithPresenceById } from '../common/UserAvatarWithPresence';
99
import ComponentWithOverlay from '../common/ComponentWithOverlay';
1010
import ZulipText from '../common/ZulipText';
1111
import Touchable from '../common/Touchable';
@@ -77,12 +77,7 @@ export default class AvatarItem extends PureComponent<Props> {
7777
overlayPosition="bottom-right"
7878
overlay={<IconCancel color="gray" size={20} />}
7979
>
80-
<UserAvatarWithPresence
81-
key={user.user_id}
82-
size={50}
83-
avatarUrl={user.avatar_url}
84-
email={user.email}
85-
/>
80+
<UserAvatarWithPresenceById key={user.user_id} size={50} userId={user.user_id} />
8681
</ComponentWithOverlay>
8782
</Touchable>
8883
<View style={styles.textFrame}>

0 commit comments

Comments
 (0)