fix: Don't force unread view to only discussions (#149)

Allow using the unread filter with questions.
This commit is contained in:
Kshitij Sobti
2022-05-13 06:15:56 +00:00
committed by GitHub
parent fd984c6ed6
commit c843d19ff2
5 changed files with 35 additions and 22 deletions

View File

@@ -219,16 +219,6 @@ describe('PostsView', () => {
secondClick: 'Discussions',
selected: ['Discussions', 'Any'],
},
{
firstClick: 'Questions',
secondClick: 'Unread',
selected: ['Discussions', 'Unread'],
},
{
firstClick: 'Unread',
secondClick: 'Questions',
selected: ['Questions', 'Any'],
},
])(
'incompatible combinations',
({

View File

@@ -60,10 +60,9 @@ function PostFilterBar({
if (name === 'type') {
dispatch(setPostsTypeFilter(value));
if (
(value === ThreadType.DISCUSSION && currentStatus === PostsStatusFilter.UNANSWERED)
|| (value === ThreadType.QUESTION && currentStatus === PostsStatusFilter.UNREAD)
value === ThreadType.DISCUSSION && currentStatus === PostsStatusFilter.UNANSWERED
) {
// You can't filter discussions by unanswered or questions by unread
// You can't filter discussions by unanswered
dispatch(setStatusFilter(PostsStatusFilter.ALL));
}
}
@@ -73,10 +72,6 @@ function PostFilterBar({
// You can't filter discussions by unanswered so switch type to questions
dispatch(setPostsTypeFilter(ThreadType.QUESTION));
}
if (value === PostsStatusFilter.UNREAD && currentType !== ThreadType.DISCUSSION) {
// You can't filter questions by unread so switch type to discussion
dispatch(setPostsTypeFilter(ThreadType.DISCUSSION));
}
}
if (name === 'sort') {
dispatch(setSortedBy(value));