File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,9 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
6464 blur : overrideProps . blur ,
6565 color : overrideProps . color || AvatarColors [ 0 ] ,
6666 conversationType : overrideProps . conversationType || 'direct' ,
67- hasAvatar : Boolean ( overrideProps . hasAvatar ) ,
67+ hasAvatar :
68+ Boolean ( overrideProps . hasAvatar ) ||
69+ ( overrideProps . avatarUrl != null && overrideProps . avatarUrl . length > 0 ) ,
6870 i18n,
6971 loading : Boolean ( overrideProps . loading ) ,
7072 noteToSelf : Boolean ( overrideProps . noteToSelf ) ,
Original file line number Diff line number Diff line change @@ -144,9 +144,10 @@ export function Avatar({
144144 } , [ avatarUrl ] ) ;
145145
146146 const initials = getInitials ( title ) ;
147- const hasImage = ! noteToSelf && avatarUrl && ! imageBroken ;
147+ const hasLocalImage = ! noteToSelf && avatarUrl && avatarUrl . length > 0 ;
148+ const hasValidImage = hasLocalImage && ! imageBroken ;
148149 const shouldUseInitials =
149- ! hasImage &&
150+ ! hasValidImage &&
150151 conversationType === 'direct' &&
151152 Boolean ( initials ) &&
152153 title !== i18n ( 'icu:unknownContact' ) ;
@@ -163,7 +164,7 @@ export function Avatar({
163164 />
164165 </ div >
165166 ) ;
166- } else if ( hasImage ) {
167+ } else if ( hasValidImage ) {
167168 assertDev ( avatarUrl , 'avatarUrl should be defined here' ) ;
168169
169170 assertDev (
@@ -207,7 +208,7 @@ export function Avatar({
207208 ) }
208209 />
209210 ) ;
210- } else if ( hasAvatar && ! hasImage ) {
211+ } else if ( hasAvatar && ! hasLocalImage ) {
211212 contentsChildren = (
212213 < >
213214 < div
You can’t perform that action at this time.
0 commit comments