From de2193e75aa4431ffd634766ede5f6b48a3f6f05 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 2 Jun 2020 14:12:14 +0200 Subject: [PATCH] changes requested by reviewers --- backend/src/db/seed.js | 12 +++++++++++- backend/src/schema/resolvers/searches.js | 6 +++--- backend/src/schema/resolvers/searches.spec.js | 2 +- .../generic/PaginationButtons/PaginationButtons.vue | 2 -- .../generic/SearchableInput/SearchableInput.spec.js | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/backend/src/db/seed.js b/backend/src/db/seed.js index 3334285d3..5442fd2db 100644 --- a/backend/src/db/seed.js +++ b/backend/src/db/seed.js @@ -928,10 +928,19 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] trollingComment.update({ disabled: true, updatedAt: new Date().toISOString(), closed: true }), ]) - await Promise.all([...Array(30).keys()].map(() => Factory.build('user'))) + const additionalUsers = await Promise.all([...Array(30).keys()].map(() => Factory.build('user'))) + + await Promise.all( + additionalUsers.map(async (user) => { + await jennyRostock.relateTo(user, 'following') + await user.relateTo(jennyRostock, 'following') + }), + ) + await Promise.all( [...Array(30).keys()].map((index) => Factory.build('user', { name: `Jenny${index}` })), ) + await Promise.all( [...Array(30).keys()].map(() => Factory.build( @@ -947,6 +956,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] ), ), ) + await Promise.all( [...Array(30).keys()].map(() => Factory.build( diff --git a/backend/src/schema/resolvers/searches.js b/backend/src/schema/resolvers/searches.js index f2edf21b1..7b157fc65 100644 --- a/backend/src/schema/resolvers/searches.js +++ b/backend/src/schema/resolvers/searches.js @@ -28,7 +28,7 @@ const postWhereClause = `WHERE score >= 0.0 const searchPostsSetup = { fulltextIndex: 'post_fulltext_search', - match: 'MATCH (resource)<-[:WROTE]-(author:User)', + match: 'MATCH (resource:Post)<-[:WROTE]-(author:User)', whereClause: postWhereClause, withClause: `WITH resource, author, [(resource)<-[:COMMENTS]-(comment:Comment) | comment] AS comments, @@ -45,7 +45,7 @@ const searchPostsSetup = { const searchUsersSetup = { fulltextIndex: 'user_fulltext_search', - match: 'MATCH (resource)', + match: 'MATCH (resource:User)', whereClause: simpleWhereClause, withClause: '', returnClause: 'resource {.*, __typename: labels(resource)[0]}', @@ -54,7 +54,7 @@ const searchUsersSetup = { const searchHashtagsSetup = { fulltextIndex: 'tag_fulltext_search', - match: 'MATCH (resource)', + match: 'MATCH (resource:Tag)', whereClause: simpleWhereClause, withClause: '', returnClause: 'resource {.*, __typename: labels(resource)[0]}', diff --git a/backend/src/schema/resolvers/searches.spec.js b/backend/src/schema/resolvers/searches.spec.js index 8d0d3b4eb..a859bf296 100644 --- a/backend/src/schema/resolvers/searches.spec.js +++ b/backend/src/schema/resolvers/searches.spec.js @@ -24,7 +24,7 @@ beforeAll(async () => { }) afterAll(async () => { - // await cleanDatabase() + await cleanDatabase() }) const searchQuery = gql` diff --git a/webapp/components/_new/generic/PaginationButtons/PaginationButtons.vue b/webapp/components/_new/generic/PaginationButtons/PaginationButtons.vue index 5fd2fd349..eb412da3c 100644 --- a/webapp/components/_new/generic/PaginationButtons/PaginationButtons.vue +++ b/webapp/components/_new/generic/PaginationButtons/PaginationButtons.vue @@ -3,7 +3,6 @@ { }) }) - it('searches for the term when enter is pressed', async () => { + it('opens the search result page when enter is pressed', async () => { select.element.value = 'ab' select.trigger('input') select.trigger('keyup.enter')