Skip to content

Commit

Permalink
feat: add env variable to display image
Browse files Browse the repository at this point in the history
  • Loading branch information
vladislavkeblysh committed Dec 10, 2024
1 parent d3b577c commit e142ee9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ USER_INFO_COOKIE_NAME=''
SUPPORT_URL=''
LEARNER_FEEDBACK_URL=''
STAFF_FEEDBACK_URL=''
ENABLE_PROFILE_IMAGE=''
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -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'
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ USER_INFO_COOKIE_NAME='edx-user-info'
SUPPORT_URL='https://support.edx.org'
LEARNER_FEEDBACK_URL=''
STAFF_FEEDBACK_URL=''
ENABLE_PROFILE_IMAGE=''
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import classNames from 'classnames';
import { AvatarOutlineAndLabelColors } from '../../../../data/constants';
import { AuthorLabel } from '../../../common';
import { useAlertBannerVisible } from '../../../data/hooks';
import {getConfig} from "@edx/frontend-platform";

Check failure on line 10 in src/discussions/post-comments/comments/comment/CommentHeader.jsx

View workflow job for this annotation

GitHub Actions / tests

`@edx/frontend-platform` import should occur before import of `../../../../data/constants`

Check failure on line 10 in src/discussions/post-comments/comments/comment/CommentHeader.jsx

View workflow job for this annotation

GitHub Actions / tests

A space is required after '{'

Check failure on line 10 in src/discussions/post-comments/comments/comment/CommentHeader.jsx

View workflow job for this annotation

GitHub Actions / tests

A space is required before '}'

Check failure on line 10 in src/discussions/post-comments/comments/comment/CommentHeader.jsx

View workflow job for this annotation

GitHub Actions / tests

Strings must use singlequote

const CommentHeader = ({
author,
Expand All @@ -25,7 +26,7 @@ const CommentHeader = ({
closed,
});

const profileImage = postUsers && Object.values(postUsers)[0].profile.image;
const profileImage = getConfig().ENABLE_PROFILE_IMAGE === 'true' && postUsers && Object.values(postUsers)[0].profile.image;

return (
<div className={classNames('d-flex flex-row justify-content-between', {
Expand Down
3 changes: 2 additions & 1 deletion src/discussions/posts/post/PostHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { AvatarOutlineAndLabelColors, ThreadType } from '../../../data/constants
import { AuthorLabel } from '../../common';
import { useAlertBannerVisible } from '../../data/hooks';
import messages from './messages';
import {getConfig} from "@edx/frontend-platform";

Check failure on line 14 in src/discussions/posts/post/PostHeader.jsx

View workflow job for this annotation

GitHub Actions / tests

`@edx/frontend-platform` import should occur before import of `../../../data/constants`

Check failure on line 14 in src/discussions/posts/post/PostHeader.jsx

View workflow job for this annotation

GitHub Actions / tests

A space is required after '{'

Check failure on line 14 in src/discussions/posts/post/PostHeader.jsx

View workflow job for this annotation

GitHub Actions / tests

A space is required before '}'

Check failure on line 14 in src/discussions/posts/post/PostHeader.jsx

View workflow job for this annotation

GitHub Actions / tests

Strings must use singlequote

export const PostAvatar = React.memo(({
author, postType, authorLabel, fromPostLink, read, postUsers,
Expand All @@ -37,7 +38,7 @@ export const PostAvatar = React.memo(({
return spacing;
}, [postType]);

const profileImage = postUsers && Object.values(postUsers)[0].profile.image;
const profileImage = getConfig().ENABLE_PROFILE_IMAGE === 'true' && postUsers && Object.values(postUsers)[0].profile.image;

return (
<div className={avatarSpacing}>
Expand Down
1 change: 1 addition & 0 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ initialize({
LEARNING_BASE_URL: process.env.LEARNING_BASE_URL,
LEARNER_FEEDBACK_URL: process.env.LEARNER_FEEDBACK_URL,
STAFF_FEEDBACK_URL: process.env.STAFF_FEEDBACK_URL,
ENABLE_PROFILE_IMAGE: process.env.ENABLE_PROFILE_IMAGE,
}, 'DiscussionsConfig');
},
},
Expand Down

0 comments on commit e142ee9

Please sign in to comment.