Skip to content
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

fix: moved feedback widget behind env variables #562

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {

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

import { PostActionsBar } from '../../components';
import { CourseTabsNavigation } from '../../components/NavigationBar';
Expand All @@ -30,7 +29,6 @@ import BlackoutInformationBanner from './BlackoutInformationBanner';
import DiscussionContent from './DiscussionContent';
import DiscussionSidebar from './DiscussionSidebar';
import useFeedbackWrapper from './FeedbackWrapper';
import InformationBanner from './InformationBanner';

const DiscussionsHome = () => {
const location = useLocation();
Expand All @@ -46,7 +44,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 = () => {
{!enableInContextSidebar && <Route path={Routes.DISCUSSIONS.PATH} component={NavigationBar} />}
<PostActionsBar />
</div>
{isFeedbackBannerVisible && <InformationBanner />}
<BlackoutInformationBanner />
</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 { 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 @@

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;

Check warning on line 28 in src/discussions/discussions-home/FeedbackWrapper.jsx

View check run for this annotation

Codecov / codecov/patch

src/discussions/discussions-home/FeedbackWrapper.jsx#L28

Added line #L28 was not covered by tests
}
try {
// eslint-disable-next-line no-undef
Expand Down
64 changes: 0 additions & 64 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 temporarily 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 @@ -45,7 +45,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
Loading