ChatInput, Author: fix "removed avatar" case

This commit is contained in:
Matilde Park 2021-03-04 12:54:37 -05:00
parent 1df231f79e
commit 93a3d22816
2 changed files with 8 additions and 6 deletions

View File

@ -128,12 +128,12 @@ class ChatInput extends Component<ChatInputProps, ChatInputState> {
const avatar = (
props.ourContact &&
((props.ourContact.avatar !== null) && !props.hideAvatars)
((props.ourContact?.avatar) && !props.hideAvatars)
)
? <BaseImage
src={props.ourContact.avatar}
height={16}
width={16}
? <BaseImage
src={props.ourContact.avatar}
height={16}
width={16}
style={{ objectFit: 'cover' }}
display='inline-block'
/>

View File

@ -7,6 +7,7 @@ import { Contacts } from '@urbit/api/contacts';
import { Group } from '@urbit/api';
import { uxToHex, cite, useShowNickname, deSig } from '~/logic/lib/util';
import useSettingsState, {selectCalmState} from "~/logic/state/settings";
import OverlaySigil from './OverlaySigil';
import { Sigil } from '~/logic/lib/sigil';
import GlobalApi from '~/logic/api/global';
@ -33,6 +34,7 @@ export default function Author(props: AuthorProps): ReactElement {
}
const color = contact?.color ? `#${uxToHex(contact?.color)}` : '#000000';
const showNickname = useShowNickname(contact);
const { hideAvatars } = useSettingsState(selectCalmState);
const name = showNickname ? contact.nickname : cite(ship);
const stamp = moment(date);
@ -43,7 +45,7 @@ export default function Author(props: AuthorProps): ReactElement {
};
const img =
contact && contact.avatar !== null ? (
contact?.avatar && !hideAvatars ? (
<BaseImage
display='inline-block'
src={contact.avatar}