diff --git a/webapp/components/_new/features/SearchResults/SearchResults.spec.js b/webapp/components/_new/features/SearchResults/SearchResults.spec.js index b76226547..19653fcac 100644 --- a/webapp/components/_new/features/SearchResults/SearchResults.spec.js +++ b/webapp/components/_new/features/SearchResults/SearchResults.spec.js @@ -36,6 +36,7 @@ describe('SearchResults', () => { } propsData = { pageSize: 12, + search: '', } wrapper = Wrapper() }) @@ -169,7 +170,7 @@ describe('SearchResults', () => { await wrapper.vm.$nextTick() await expect( wrapper.vm.$options.apollo.searchPosts.variables.bind(wrapper.vm)(), - ).toMatchObject({ query: undefined, firstPosts: 12, postsOffset: 12 }) + ).toMatchObject({ query: '', firstPosts: 12, postsOffset: 12 }) }) it('displays the next page button when next-button is clicked', async () => { @@ -199,7 +200,7 @@ describe('SearchResults', () => { await wrapper.vm.$nextTick() await expect( wrapper.vm.$options.apollo.searchPosts.variables.bind(wrapper.vm)(), - ).toMatchObject({ query: undefined, firstPosts: 12, postsOffset: 24 }) + ).toMatchObject({ query: '', firstPosts: 12, postsOffset: 24 }) }) it('deactivates next page button when next-button is clicked twice', async () => { @@ -234,7 +235,7 @@ describe('SearchResults', () => { await wrapper.vm.$nextTick() await expect( wrapper.vm.$options.apollo.searchPosts.variables.bind(wrapper.vm)(), - ).toMatchObject({ query: undefined, firstPosts: 12, postsOffset: 0 }) + ).toMatchObject({ query: '', firstPosts: 12, postsOffset: 0 }) }) }) }) diff --git a/webapp/components/_new/features/SearchResults/SearchResults.vue b/webapp/components/_new/features/SearchResults/SearchResults.vue index 37d928311..20385ce64 100644 --- a/webapp/components/_new/features/SearchResults/SearchResults.vue +++ b/webapp/components/_new/features/SearchResults/SearchResults.vue @@ -120,6 +120,7 @@ import PaginationButtons from '~/components/_new/generic/PaginationButtons/Pagin import HcHashtag from '~/components/Hashtag/Hashtag' export default { + name: 'SearchResults', components: { TabNavigation, HcEmpty, @@ -372,7 +373,7 @@ export default { }, searchGroups: { query() { - return searchGroups + return searchGroups(this.i18n) }, variables() { const { firstGroups, groupsOffset, search } = this diff --git a/webapp/graphql/Search.js b/webapp/graphql/Search.js index d2131ddc0..96789574d 100644 --- a/webapp/graphql/Search.js +++ b/webapp/graphql/Search.js @@ -61,19 +61,45 @@ export const searchPosts = gql` } ` -export const searchGroups = gql` - ${groupFragment} - - query ($query: String!, $firstGroups: Int, $groupsOffset: Int) { - searchGroups(query: $query, firstGroups: $firstGroups, groupsOffset: $groupsOffset) { - groupCount - groups { - __typename - ...group +export const searchGroups = (i18n) => { + const lang = i18n ? i18n.locale().toUpperCase() : 'EN' + return gql` + query ($query: String!, $firstGroups: Int, $groupsOffset: Int) { + searchGroups(query: $query, firstGroups: $firstGroups, groupsOffset: $groupsOffset) { + groupCount + groups { + __typename + id + name + slug + createdAt + updatedAt + disabled + deleted + about + description + descriptionExcerpt + groupType + actionRadius + categories { + id + slug + name + icon + } + avatar { + url + } + locationName + location { + name: name${lang} + } + myRole + } } } - } -` + ` +} export const searchUsers = gql` ${userFragment}