-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Profile image on user posts #574
base: master
Are you sure you want to change the base?
Changes from all commits
f192216
770cd1f
a5675d7
8deccf0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ USER_INFO_COOKIE_NAME='' | |
SUPPORT_URL='' | ||
LEARNER_FEEDBACK_URL='' | ||
STAFF_FEEDBACK_URL='' | ||
ENABLE_PROFILE_IMAGE='' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ USER_INFO_COOKIE_NAME='edx-user-info' | |
SUPPORT_URL='https://support.edx.org' | ||
LEARNER_FEEDBACK_URL='' | ||
STAFF_FEEDBACK_URL='' | ||
ENABLE_PROFILE_IMAGE='true' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change it into empty string |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ import PropTypes from 'prop-types'; | |
import { Avatar } from '@openedx/paragon'; | ||
import classNames from 'classnames'; | ||
|
||
import { getConfig } from '@edx/frontend-platform'; | ||
|
||
import { AvatarOutlineAndLabelColors } from '../../../../data/constants'; | ||
import { AuthorLabel } from '../../../common'; | ||
import { useAlertBannerVisible } from '../../../data/hooks'; | ||
|
@@ -15,6 +17,7 @@ const CommentHeader = ({ | |
closed, | ||
createdAt, | ||
lastEdit, | ||
postUsers, | ||
}) => { | ||
const colorClass = AvatarOutlineAndLabelColors[authorLabel]; | ||
const hasAnyAlert = useAlertBannerVisible({ | ||
|
@@ -24,6 +27,8 @@ const CommentHeader = ({ | |
closed, | ||
}); | ||
|
||
const profileImage = getConfig().ENABLE_PROFILE_IMAGE === 'true' && postUsers && Object.values(postUsers)[0].profile.image; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we simplify it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it’s better to leave it as is because it’s a more secure check. |
||
|
||
return ( | ||
<div className={classNames('d-flex flex-row justify-content-between', { | ||
'mt-2': hasAnyAlert, | ||
|
@@ -33,6 +38,7 @@ const CommentHeader = ({ | |
<Avatar | ||
className={`border-0 ml-0.5 mr-2.5 ${colorClass ? `outline-${colorClass}` : 'outline-anonymous'}`} | ||
alt={author} | ||
src={profileImage?.hasImage ? profileImage?.imageUrlSmall : undefined} | ||
style={{ | ||
width: '32px', | ||
height: '32px', | ||
|
@@ -61,6 +67,7 @@ CommentHeader.propTypes = { | |
editorUsername: PropTypes.string, | ||
reason: PropTypes.string, | ||
}), | ||
postUsers: PropTypes.shape({}).isRequired, | ||
}; | ||
|
||
CommentHeader.defaultProps = { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disable it by default.