Skip to content

Commit

Permalink
fix: moved feedback widget behind the env variable (#557)
Browse files Browse the repository at this point in the history
* feat: remove InformationBanner from Discussion MFE

* fix: moved feedback widget behind the env variable
  • Loading branch information
awais-ansari authored Aug 21, 2023
1 parent 61d0f9a commit 2609380
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 234 deletions.
5 changes: 2 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ SEGMENT_KEY=''
SITE_NAME=''
USER_INFO_COOKIE_NAME=''
SUPPORT_URL=''
TA_FEEDBACK_FORM= ''
STAFF_FEEDBACK_FORM= ''
DISPLAY_FEEDBACK_BANNER='false'
LEARNER_FEEDBACK_URL=''
STAFF_FEEDBACK_URL=''
5 changes: 2 additions & 3 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ SEGMENT_KEY=''
SITE_NAME=localhost
USER_INFO_COOKIE_NAME='edx-user-info'
SUPPORT_URL='https://support.edx.org'
TA_FEEDBACK_FORM='https://learner-form.test'
STAFF_FEEDBACK_FORM='https://staff-form.test'
DISPLAY_FEEDBACK_BANNER='false'
LEARNER_FEEDBACK_URL=''
STAFF_FEEDBACK_URL=''
5 changes: 2 additions & 3 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ SEGMENT_KEY=''
SITE_NAME='localhost'
USER_INFO_COOKIE_NAME='edx-user-info'
SUPPORT_URL='https://support.edx.org'
TA_FEEDBACK_FORM='https://learner-form.test'
STAFF_FEEDBACK_FORM='https://staff-form.test'
DISPLAY_FEEDBACK_BANNER='false'
LEARNER_FEEDBACK_URL=''
STAFF_FEEDBACK_URL=''
2 changes: 0 additions & 2 deletions .jest/setEnvVars.js

This file was deleted.

4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { createConfig } = require('@edx/frontend-build');

module.exports = createConfig('jest', {
// setupFilesAfterEnv is used after the jest environment has been loaded. In general this is what you want.
// setupFilesAfterEnv is used after the jest environment has been loaded. In general this is what you want.
// If you want to add config BEFORE jest loads, use setupFiles instead.
setupFiles: ['<rootDir>/.jest/setEnvVars.js'],
setupFiles: ['<rootDir>/.env.test'],
setupFilesAfterEnv: [
'<rootDir>/src/setupTest.js',
],
Expand Down
4 changes: 0 additions & 4 deletions src/discussions/discussions-home/DiscussionsHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from 'react-router';

import { LearningHeader as Header } from '@edx/frontend-component-header';
import { getConfig } from '@edx/frontend-platform';

import { Spinner } from '../../components';
import { selectCourseTabs } from '../../components/NavigationBar/data/selectors';
Expand All @@ -33,7 +32,6 @@ const DiscussionsProductTour = lazy(() => import('../tours/DiscussionsProductTou
const DiscussionsRestrictionBanner = lazy(() => import('./DiscussionsRestrictionBanner'));
const DiscussionContent = lazy(() => import('./DiscussionContent'));
const DiscussionSidebar = lazy(() => import('./DiscussionSidebar'));
const InformationBanner = lazy(() => import('./InformationBanner'));

const DiscussionsHome = () => {
const location = useLocation();
Expand All @@ -48,7 +46,6 @@ const DiscussionsHome = () => {
const isOnDesktop = useIsOnDesktop();
let displaySidebar = useSidebarVisible();
const enableInContextSidebar = Boolean(new URLSearchParams(location.search).get('inContextSidebar') !== null);
const isFeedbackBannerVisible = getConfig().DISPLAY_FEEDBACK_BANNER === 'true';
const {
courseId, postId, topicId, category, learnerUsername,
} = params;
Expand Down Expand Up @@ -95,7 +92,6 @@ const DiscussionsHome = () => {
)}
<PostActionsBar />
</div>
{isFeedbackBannerVisible && <InformationBanner />}
<DiscussionsRestrictionBanner />
</div>
{provider === DiscussionProvider.LEGACY && (
Expand Down
5 changes: 3 additions & 2 deletions src/discussions/discussions-home/FeedbackWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect } from 'react';

import { useSelector } from 'react-redux';

import { getConfig } from '@edx/frontend-platform';
import { logError } from '@edx/frontend-platform/logging';

import { RequestStatus } from '../../data/constants';
Expand All @@ -22,9 +23,9 @@ export default function useFeedbackWrapper() {

useEffect(() => {
if (configStatus === RequestStatus.SUCCESSFUL) {
let url = '//w.usabilla.com/9e6036348fa1.js';
let url = getConfig().LEARNER_FEEDBACK_URL;
if (isStaff || isUserGroupTA || isCourseAdmin || isCourseStaff) {
url = '//w.usabilla.com/767740a06856.js';
url = getConfig().STAFF_FEEDBACK_URL;
}
try {
// eslint-disable-next-line no-undef
Expand Down
63 changes: 0 additions & 63 deletions src/discussions/discussions-home/InformationBanner.jsx

This file was deleted.

136 changes: 0 additions & 136 deletions src/discussions/discussions-home/InformationBanner.test.jsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/discussions/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,21 +168,6 @@ const messages = defineMessages({
defaultMessage: 'anonymous',
description: 'Author name displayed when a post is anonymous',
},
bannerMessage: {
id: 'discussion.banner.welcomeMessage',
defaultMessage: '🎉 Welcome to the new and improved discussions experience!',
description: 'Information banner welcome text',
},
learnMoreBannerLink: {
id: 'discussion.banner.learnMore',
defaultMessage: 'Learn more',
description: 'learn more button to redirect users to know more about new discussion experience ',
},
shareFeedback: {
id: 'discussion.banner.shareFeedback',
defaultMessage: 'Share feedback',
description: 'Share feedback button to open feedback forms',
},
blackoutDiscussionInformation: {
id: 'discussion.blackoutBanner.information',
defaultMessage: 'Posting in discussions is disabled by the course team',
Expand Down
3 changes: 2 additions & 1 deletion src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ initialize({
config: () => {
mergeConfig({
LEARNING_BASE_URL: process.env.LEARNING_BASE_URL,
DISPLAY_FEEDBACK_BANNER: process.env.DISPLAY_FEEDBACK_BANNER || 'false',
LEARNER_FEEDBACK_URL: process.env.LEARNER_FEEDBACK_URL,
STAFF_FEEDBACK_URL: process.env.STAFF_FEEDBACK_URL,
}, 'DiscussionsConfig');
},
},
Expand Down

0 comments on commit 2609380

Please sign in to comment.