Merge pull request #9 from open-craft/joaocabrita/bb4418-search_posts

[BD-38][TNL-8428] feat: Implement post search.
This commit is contained in:
AsadAzam
2021-08-02 11:33:53 +05:00
committed by GitHub
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}
/>
),