Skip to content

Commit

Permalink
fix: moved feedback widget behind the env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
awais-ansari committed Aug 15, 2023
1 parent 962944c commit 1ac8567
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ SEGMENT_KEY=''
SITE_NAME=''
USER_INFO_COOKIE_NAME=''
SUPPORT_URL=''
LEARNER_FEEDBACK_URL=''
STAFF_FEEDBACK_URL=''
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ SEGMENT_KEY=''
SITE_NAME=localhost
USER_INFO_COOKIE_NAME='edx-user-info'
SUPPORT_URL='https://support.edx.org'
LEARNER_FEEDBACK_URL=''
STAFF_FEEDBACK_URL=''
2 changes: 2 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ SEGMENT_KEY=''
SITE_NAME='localhost'
USER_INFO_COOKIE_NAME='edx-user-info'
SUPPORT_URL='https://support.edx.org'
LEARNER_FEEDBACK_URL=''
STAFF_FEEDBACK_URL=''
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;

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
2 changes: 2 additions & 0 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ initialize({
config: () => {
mergeConfig({
LEARNING_BASE_URL: process.env.LEARNING_BASE_URL,
LEARNER_FEEDBACK_URL: process.env.LEARNER_FEEDBACK_URL,
STAFF_FEEDBACK_URL: process.env.STAFF_FEEDBACK_URL,
}, 'DiscussionsConfig');
},
},
Expand Down

0 comments on commit 1ac8567

Please sign in to comment.