feat: Implement post search.

Related tickets:
* [TNL-8428](https://openedx.atlassian.net/browse/TNL-8428)
* [BB-4418 (OpenCraft Internal)](https://tasks.opencraft.com/browse/BB-4418)
This commit is contained in:
João Cabrita
2021-07-18 15:04:41 +01:00
parent 812248f8c8
commit c4244cf95a
3 changed files with 6 additions and 2 deletions

View File

@@ -60,6 +60,9 @@ export function fetchThreads(courseId, {
if (filters.status === PostsStatusFilter.UNREAD) {
options.view = 'unread';
}
if (filters.search) {
options.textSearch = filters.search;
}
return async (dispatch) => {
try {
dispatch(fetchThreadsRequest({ courseId }));

View File

@@ -13,8 +13,9 @@ function PostActionsBar({ intl }) {
return (
<div className="d-flex justify-content-end py-1">
<SearchField
placeholder={intl.formatMessage(messages.searchAllPosts)}
onClear={() => dispatch(setSearchQuery(''))}
onSubmit={(value) => dispatch(setSearchQuery(value))}
placeholder={intl.formatMessage(messages.searchAllPosts)}
/>
<Button variant="outline-primary" className="ml-2">
{intl.formatMessage(messages.addAPost)}

View File

@@ -32,7 +32,7 @@ function TopicsView() {
id={topicGroup.id}
name={topicGroup.name}
subtopics={topicGroup.children}
key={topicGroup.name}
key={topicGroup.id}
filter={filter}
/>
),