feat: add unresponded posts filter

This commit is contained in:
Mehak Nasir
2022-11-08 15:12:38 +05:00
committed by Mehak Nasir
parent 6d87bf879d
commit dfd880d4b3
4 changed files with 15 additions and 2 deletions

View File

@@ -197,7 +197,7 @@ describe('PostsView', () => {
// 5 status filters: any, unread, following, reported, unanswered
// 3 sort: activity, comments, likes
// 2 cohort: all groups, 1 api mock response cohort
expect(screen.queryAllByRole('radio')).toHaveLength(13);
expect(screen.queryAllByRole('radio')).toHaveLength(14);
});
test('test that the cohorts filter works', async () => {

View File

@@ -120,6 +120,9 @@ export function fetchThreads(courseId, {
if (filters.status === PostsStatusFilter.UNANSWERED) {
options.view = 'unanswered';
}
if (filters.status === PostsStatusFilter.UNRESPONDED) {
options.view = 'unresponded';
}
if (filters.status === PostsStatusFilter.REPORTED) {
options.flagged = true;
}

View File

@@ -95,6 +95,10 @@ function PostFilterBar({
// You can't filter discussions by unanswered so switch type to questions
dispatch(setPostsTypeFilter(ThreadType.QUESTION));
}
if (value === PostsStatusFilter.UNRESPONDED && currentType !== ThreadType.DISCUSSION) {
// You can't filter questions by not responded so switch type to discussion
dispatch(setPostsTypeFilter(ThreadType.DISCUSSION));
}
}
if (name === 'sort') {
dispatch(setSortedBy(value));
@@ -200,6 +204,12 @@ function PostFilterBar({
value={PostsStatusFilter.UNANSWERED}
selected={currentFilters.status}
/>
<ActionItem
id="status-unresponded"
label={intl.formatMessage(messages.filterUnresponded)}
value={PostsStatusFilter.UNRESPONDED}
selected={currentFilters.status}
/>
</Form.RadioSet>
<Form.RadioSet
name="sort"

View File

@@ -48,7 +48,7 @@ const messages = defineMessages({
},
filterUnresponded: {
id: 'discussions.posts.status.filter.unresponded',
defaultMessage: 'Unresponded',
defaultMessage: 'Not responded',
description: 'Option in dropdown to filter to unresponded posts',
},
myPosts: {