mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
have i18n as option for search groups, fix test
This commit is contained in:
parent
e27f9b00e6
commit
88b5fb9b46
@ -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 })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user