From 095d4296e3a97b99736d4fe457312580d41a457e Mon Sep 17 00:00:00 2001 From: sundasnoreen12 <72802712+sundasnoreen12@users.noreply.github.com> Date: Thu, 25 Jan 2024 18:56:25 +0500 Subject: [PATCH] fix: fixed Learner Post filter issue (#651) * fix: fixed Learner Post filter issue * refactor: removed different variable declaration --------- Co-authored-by: Awais Ansari <79941147+awais-ansari@users.noreply.github.com> --- .../learner-post-filter-bar/LearnerPostFilterBar.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/discussions/learners/learner-post-filter-bar/LearnerPostFilterBar.jsx b/src/discussions/learners/learner-post-filter-bar/LearnerPostFilterBar.jsx index cebab560..1a643d21 100644 --- a/src/discussions/learners/learner-post-filter-bar/LearnerPostFilterBar.jsx +++ b/src/discussions/learners/learner-post-filter-bar/LearnerPostFilterBar.jsx @@ -7,6 +7,7 @@ import { useParams } from 'react-router-dom'; import { sendTrackEvent } from '@edx/frontend-platform/analytics'; import FilterBar from '../../../components/FilterBar'; +import { PostsStatusFilter, ThreadType } from '../../../data/constants'; import { selectCourseCohorts } from '../../cohorts/data/selectors'; import { fetchCourseCohorts } from '../../cohorts/data/thunks'; import { selectUserHasModerationPrivileges, selectUserIsGroupTa } from '../../data/selectors'; @@ -58,10 +59,16 @@ const LearnerPostFilterBar = () => { } } else if (name === 'status') { if (postFilter.status !== value) { + const postType = (value === PostsStatusFilter.UNANSWERED && ThreadType.QUESTION) + || (value === PostsStatusFilter.UNRESPONDED && ThreadType.DISCUSSION) + || postFilter.postType; + dispatch(setPostFilter({ ...postFilter, + postType, status: value, })); + filterContentEventProperties.statusFilter = value; } } else if (name === 'orderBy') {