mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Fix cypress tests
This commit is contained in:
parent
46c4602db1
commit
cce28e6c7a
@ -8,10 +8,8 @@ const transformReturnType = record => {
|
|||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
Query: {
|
Query: {
|
||||||
findResources: async (_parent, params, context, _resolveInfo) => {
|
findResources: async (_parent, args, context, _resolveInfo) => {
|
||||||
params = await filterForBlockedUsers(params, context)
|
const { query, limit } = args
|
||||||
const { query, limit } = params
|
|
||||||
const filter = { ...params.filter }
|
|
||||||
const { id: thisUserId } = context.user
|
const { id: thisUserId } = context.user
|
||||||
// see http://lucene.apache.org/core/8_3_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package.description
|
// see http://lucene.apache.org/core/8_3_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package.description
|
||||||
const myQuery = query.replace(/\s/g, '* ') + '*'
|
const myQuery = query.replace(/\s/g, '* ') + '*'
|
||||||
@ -20,9 +18,8 @@ export default {
|
|||||||
YIELD node as resource, score
|
YIELD node as resource, score
|
||||||
MATCH (resource)<-[:WROTE]-(user:User)
|
MATCH (resource)<-[:WROTE]-(user:User)
|
||||||
WHERE score >= 0.5
|
WHERE score >= 0.5
|
||||||
AND NOT (user.deleted = true AND NOT user.disabled = true
|
AND NOT (user.deleted = true OR user.disabled = true
|
||||||
OR resource.deleted = true AND NOT resource.disabled = true
|
OR resource.deleted = true OR resource.disabled = true
|
||||||
OR user.id in COALESCE($filter.author_not.id_in, [])
|
|
||||||
OR (:User { id: $thisUserId })-[:BLOCKED]-(user))
|
OR (:User { id: $thisUserId })-[:BLOCKED]-(user))
|
||||||
RETURN resource, labels(resource)[0] AS type
|
RETURN resource, labels(resource)[0] AS type
|
||||||
LIMIT $limit
|
LIMIT $limit
|
||||||
@ -32,7 +29,6 @@ export default {
|
|||||||
const readPostTxResultPromise = session.readTransaction(async transaction => {
|
const readPostTxResultPromise = session.readTransaction(async transaction => {
|
||||||
const postTransactionResponse = transaction.run(postCypher, {
|
const postTransactionResponse = transaction.run(postCypher, {
|
||||||
query: myQuery,
|
query: myQuery,
|
||||||
filter,
|
|
||||||
limit,
|
limit,
|
||||||
thisUserId,
|
thisUserId,
|
||||||
})
|
})
|
||||||
@ -49,7 +45,7 @@ export default {
|
|||||||
YIELD node as resource, score
|
YIELD node as resource, score
|
||||||
MATCH (resource)
|
MATCH (resource)
|
||||||
WHERE score >= 0.5
|
WHERE score >= 0.5
|
||||||
AND NOT (resource.deleted = true AND NOT resource.disabled = true
|
AND NOT (resource.deleted = true OR resource.disabled = true
|
||||||
OR (:User { id: $thisUserId })-[:BLOCKED]-(resource))
|
OR (:User { id: $thisUserId })-[:BLOCKED]-(resource))
|
||||||
RETURN resource, labels(resource)[0] AS type
|
RETURN resource, labels(resource)[0] AS type
|
||||||
LIMIT $limit
|
LIMIT $limit
|
||||||
@ -57,7 +53,6 @@ export default {
|
|||||||
const readUserTxResultPromise = session.readTransaction(async transaction => {
|
const readUserTxResultPromise = session.readTransaction(async transaction => {
|
||||||
const userTransactionResponse = transaction.run(userCypher, {
|
const userTransactionResponse = transaction.run(userCypher, {
|
||||||
query: myQuery,
|
query: myQuery,
|
||||||
filter,
|
|
||||||
limit,
|
limit,
|
||||||
thisUserId,
|
thisUserId,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -37,7 +37,7 @@ Feature: Block a User
|
|||||||
And I refresh the page
|
And I refresh the page
|
||||||
And I search for "Spam"
|
And I search for "Spam"
|
||||||
Then the search has no results
|
Then the search has no results
|
||||||
But I search for "not blocked"
|
But I search for "blocked"
|
||||||
Then I should see the following posts in the select dropdown:
|
Then I should see the following posts in the select dropdown:
|
||||||
| title |
|
| title |
|
||||||
| Post that should be seen |
|
| Post that should be seen |
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user