@@ -5,6 +5,7 @@ import { Avatar, Badge, Icon } from '@openedx/paragon';
5
5
import { Question } from '@openedx/paragon/icons' ;
6
6
import classNames from 'classnames' ;
7
7
8
+ import { getConfig } from '@edx/frontend-platform' ;
8
9
import { useIntl } from '@edx/frontend-platform/i18n' ;
9
10
10
11
import { AvatarOutlineAndLabelColors , ThreadType } from '../../../data/constants' ;
@@ -13,7 +14,7 @@ import { useAlertBannerVisible } from '../../data/hooks';
13
14
import messages from './messages' ;
14
15
15
16
export const PostAvatar = React . memo ( ( {
16
- author, postType, authorLabel, fromPostLink, read,
17
+ author, postType, authorLabel, fromPostLink, read, postUsers ,
17
18
} ) => {
18
19
const outlineColor = AvatarOutlineAndLabelColors [ authorLabel ] ;
19
20
@@ -37,6 +38,8 @@ export const PostAvatar = React.memo(({
37
38
return spacing ;
38
39
} , [ postType ] ) ;
39
40
41
+ const profileImage = getConfig ( ) . ENABLE_PROFILE_IMAGE === 'true' && postUsers && Object . values ( postUsers ) [ 0 ] . profile . image ;
42
+
40
43
return (
41
44
< div className = { avatarSpacing } >
42
45
{ postType === ThreadType . QUESTION && (
@@ -59,6 +62,7 @@ export const PostAvatar = React.memo(({
59
62
height : avatarSize ,
60
63
width : avatarSize ,
61
64
} }
65
+ src = { profileImage ?. hasImage ? profileImage ?. imageUrlSmall : undefined }
62
66
alt = { author }
63
67
/>
64
68
</ div >
@@ -71,6 +75,7 @@ PostAvatar.propTypes = {
71
75
authorLabel : PropTypes . string ,
72
76
fromPostLink : PropTypes . bool ,
73
77
read : PropTypes . bool ,
78
+ postUsers : PropTypes . shape ( { } ) . isRequired ,
74
79
} ;
75
80
76
81
PostAvatar . defaultProps = {
@@ -90,6 +95,7 @@ const PostHeader = ({
90
95
title,
91
96
postType,
92
97
preview,
98
+ postUsers,
93
99
} ) => {
94
100
const intl = useIntl ( ) ;
95
101
const showAnsweredBadge = preview && hasEndorsed && postType === ThreadType . QUESTION ;
@@ -101,7 +107,7 @@ const PostHeader = ({
101
107
return (
102
108
< div className = { classNames ( 'd-flex flex-fill mw-100' , { 'mt-10px' : hasAnyAlert && ! preview } ) } >
103
109
< div className = "flex-shrink-0" >
104
- < PostAvatar postType = { postType } author = { author } authorLabel = { authorLabel } />
110
+ < PostAvatar postType = { postType } author = { author } authorLabel = { authorLabel } postUsers = { postUsers } />
105
111
</ div >
106
112
< div className = "align-items-center d-flex flex-row" >
107
113
< div className = "d-flex flex-column justify-content-start mw-100" >
@@ -151,6 +157,7 @@ PostHeader.propTypes = {
151
157
reason : PropTypes . string ,
152
158
} ) ,
153
159
closed : PropTypes . bool ,
160
+ postUsers : PropTypes . shape ( { } ) . isRequired ,
154
161
} ;
155
162
156
163
PostHeader . defaultProps = {
0 commit comments