mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Merge pull request #1397 from Human-Connection/performance-improvement
Check there are ids in the badIds array
This commit is contained in:
commit
0a5052ba96
@ -11,6 +11,8 @@ const filterForBlockedUsers = async (params, context) => {
|
||||
getBlockedByUsers(context),
|
||||
])
|
||||
const badIds = [...blockedByUsers.map(b => b.id), ...blockedUsers.map(b => b.id)]
|
||||
if (!badIds.length) return params
|
||||
|
||||
params.filter = mergeWith(
|
||||
params.filter,
|
||||
{
|
||||
|
||||
@ -4,7 +4,7 @@ type Query {
|
||||
currentUser: User
|
||||
# Get the latest Network Statistics
|
||||
statistics: Statistics!
|
||||
findPosts(query: String!, limit: Int = 10): [Post]!
|
||||
findPosts(query: String!, limit: Int = 10, filter: _PostFilter): [Post]!
|
||||
@cypher(
|
||||
statement: """
|
||||
CALL db.index.fulltext.queryNodes('full_text_search', $query)
|
||||
|
||||
@ -168,13 +168,13 @@ Given("we have the following posts in our database:", table => {
|
||||
};
|
||||
postAttributes.deleted = Boolean(postAttributes.deleted);
|
||||
const disabled = Boolean(postAttributes.disabled);
|
||||
postAttributes.categoryIds = [`cat${i}`];
|
||||
postAttributes.categoryIds = [`cat${i}${new Date()}`];
|
||||
postAttributes;
|
||||
cy.factory()
|
||||
.create("User", userAttributes)
|
||||
.authenticateAs(userAttributes)
|
||||
.create("Category", {
|
||||
id: `cat${i}`,
|
||||
id: `cat${i}${new Date()}`,
|
||||
name: "Just For Fun",
|
||||
slug: `just-for-fun-${i}`,
|
||||
icon: "smile"
|
||||
|
||||
@ -26,6 +26,9 @@ Feature: Block a User
|
||||
And nobody is following the user profile anymore
|
||||
|
||||
Scenario: Posts of blocked users are filtered from search results
|
||||
Given we have the following posts in our database:
|
||||
| Author | id | title | content |
|
||||
| Some unblocked user | im-not-blocked | Post that should be seen | cause I'm not blocked |
|
||||
Given "Spammy Spammer" wrote a post "Spam Spam Spam"
|
||||
When I search for "Spam"
|
||||
Then I should see the following posts in the select dropdown:
|
||||
@ -35,3 +38,7 @@ Feature: Block a User
|
||||
And I refresh the page
|
||||
And I search for "Spam"
|
||||
Then the search has no results
|
||||
But I search for "not blocked"
|
||||
Then I should see the following posts in the select dropdown:
|
||||
| title |
|
||||
| Post that should be seen |
|
||||
|
||||
@ -46,8 +46,8 @@ export const actions = {
|
||||
await this.app.apolloProvider.defaultClient
|
||||
.query({
|
||||
query: gql`
|
||||
query findPosts($query: String!) {
|
||||
findPosts(query: $query, limit: 10) {
|
||||
query findPosts($query: String!, $filter: _PostFilter) {
|
||||
findPosts(query: $query, limit: 10, filter: $filter) {
|
||||
id
|
||||
slug
|
||||
label: title
|
||||
@ -64,6 +64,7 @@ export const actions = {
|
||||
`,
|
||||
variables: {
|
||||
query: value.replace(/\s/g, '~ ') + '~',
|
||||
filter: {},
|
||||
},
|
||||
})
|
||||
.then(res => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user