diff --git a/backend/src/middleware/permissionsMiddleware.js b/backend/src/middleware/permissionsMiddleware.js
index 12a557232..3b42ae7fe 100644
--- a/backend/src/middleware/permissionsMiddleware.js
+++ b/backend/src/middleware/permissionsMiddleware.js
@@ -102,7 +102,6 @@ export default shield(
blockedUsers: isAuthenticated,
notifications: isAuthenticated,
Donations: isAuthenticated,
- blockedByPostAuthor: isAuthenticated,
},
Mutation: {
'*': deny,
diff --git a/backend/src/schema/resolvers/users.js b/backend/src/schema/resolvers/users.js
index c2600ab24..0b3f13631 100644
--- a/backend/src/schema/resolvers/users.js
+++ b/backend/src/schema/resolvers/users.js
@@ -48,29 +48,6 @@ export default {
throw new UserInputError(e.message)
}
},
- blockedByPostAuthor: async (_parent, params, context, _resolveInfo) => {
- const { postAuthorId } = params
- const { user, driver } = context
- const session = driver.session()
- const readTxResultPromise = session.readTransaction(async transaction => {
- const blockedByPostAuthorTransactionResponse = await transaction.run(
- `
- MATCH (currentUser:User {id: $currentUserId})<-[relationship:BLOCKED]-(postAuthor:User {id: $postAuthorId})
- RETURN COUNT(relationship) >= 1 as blockedByPostAuthor
- `,
- { postAuthorId, currentUserId: user.id },
- )
- return blockedByPostAuthorTransactionResponse.records.map(record =>
- record.get('blockedByPostAuthor'),
- )
- })
- try {
- const [blockedByPostAuthor] = await readTxResultPromise
- return blockedByPostAuthor
- } finally {
- session.close()
- }
- },
User: async (object, args, context, resolveInfo) => {
const { email } = args
if (email) {
diff --git a/backend/src/schema/types/type/User.gql b/backend/src/schema/types/type/User.gql
index 17ee2a733..715a1f3e1 100644
--- a/backend/src/schema/types/type/User.gql
+++ b/backend/src/schema/types/type/User.gql
@@ -71,7 +71,7 @@ type User {
isBlocked: Boolean! @cypher(
statement: """
- MATCH (this)<-[:BLOCKED]-(user:User {id: $cypherParams.currentUserId})
+ MATCH (this)-[:BLOCKED]-(user:User {id: $cypherParams.currentUserId})
RETURN COUNT(user) >= 1
"""
)
@@ -160,7 +160,6 @@ type Query {
orderBy: [_UserOrdering]
filter: _UserFilter
): [User]
- blockedByPostAuthor(postAuthorId: ID!): Boolean!
blockedUsers: [User]
currentUser: User
}
diff --git a/webapp/graphql/PostQuery.js b/webapp/graphql/PostQuery.js
index c59c894a5..a3ac8345a 100644
--- a/webapp/graphql/PostQuery.js
+++ b/webapp/graphql/PostQuery.js
@@ -29,6 +29,7 @@ export default i18n => {
...user
...userCounts
...locationAndBadges
+ isBlocked
}
comments(orderBy: createdAt_asc) {
...comment
diff --git a/webapp/graphql/User.js b/webapp/graphql/User.js
index fa4b47423..4ed832ad3 100644
--- a/webapp/graphql/User.js
+++ b/webapp/graphql/User.js
@@ -216,10 +216,3 @@ export const checkSlugAvailableQuery = gql`
}
}
`
-export const blockedByPostAuthor = () => {
- return gql`
- query($postAuthorId: ID!) {
- blockedByPostAuthor(postAuthorId: $postAuthorId)
- }
- `
-}
diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue
index bdfa13cf2..41e9f4503 100644
--- a/webapp/pages/post/_id/_slug/index.vue
+++ b/webapp/pages/post/_id/_slug/index.vue
@@ -90,7 +90,7 @@
/>
@@ -120,7 +120,6 @@ import { postMenuModalsData, deletePostMutation } from '~/components/utils/PostH
import PostQuery from '~/graphql/PostQuery'
import HcEmotions from '~/components/Emotions/Emotions'
import PostMutations from '~/graphql/PostMutations'
-import { blockedByPostAuthor } from '~/graphql/User'
export default {
name: 'PostSlug',
@@ -231,20 +230,6 @@ export default {
},
fetchPolicy: 'cache-and-network',
},
- blockedByPostAuthor: {
- query() {
- return blockedByPostAuthor()
- },
- variables() {
- return {
- postAuthorId: this.postAuthor ? this.postAuthor.id : this.$store.getters['auth/user'].id,
- }
- },
- update({ blockedByPostAuthor }) {
- this.blocked = blockedByPostAuthor
- },
- fetchPolicy: 'cache-and-network',
- },
},
}