From 478f6fef1cfb5b9c59684cf276122a223d038aa3 Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Tue, 1 Oct 2019 20:57:45 +0200 Subject: [PATCH] Fix query builder/test --- backend/src/schema/resolvers/users.js | 2 +- cypress/integration/common/report.js | 8 +++++++- cypress/integration/moderation/ReportContent.feature | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/src/schema/resolvers/users.js b/backend/src/schema/resolvers/users.js index 057e52435..616e1d194 100644 --- a/backend/src/schema/resolvers/users.js +++ b/backend/src/schema/resolvers/users.js @@ -30,7 +30,7 @@ export const getBlockedByUsers = async context => { .relationship(userModel.relationships().get('blocked')) .to('blocked', userModel) .where('blocked.id', context.user.id) - .where('blocked.user', 'user') + .where('blocked.role', 'user') .return('user') blockedByUsers = await blockedByUsers.execute() blockedByUsers = blockedByUsers.records.map(r => r.get('user').properties) diff --git a/cypress/integration/common/report.js b/cypress/integration/common/report.js index a60068f04..c22651385 100644 --- a/cypress/integration/common/report.js +++ b/cypress/integration/common/report.js @@ -5,7 +5,7 @@ import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps' let lastReportTitle let davidIrvingPostTitle = 'The Truth about the Holocaust' let davidIrvingPostSlug = 'the-truth-about-the-holocaust' -let davidIrvingName = 'David Irving' +let annoyingUserWhoBlockedModeratorTitle = 'Fake news' const savePostTitle = $post => { return $post @@ -139,6 +139,12 @@ Then('I see all the reported posts including the one from above', () => { }) }) +Then('I see all the reported posts including from the user who blocked me', () => { + cy.get('table tbody').within(() => { + cy.contains('tr', annoyingUserWhoBlockedModeratorTitle) + }) +}) + Then('each list item links to the post page', () => { cy.contains(davidIrvingPostTitle).click() cy.location('pathname').should('contain', '/post') diff --git a/cypress/integration/moderation/ReportContent.feature b/cypress/integration/moderation/ReportContent.feature index c35099fd8..351f087fb 100644 --- a/cypress/integration/moderation/ReportContent.feature +++ b/cypress/integration/moderation/ReportContent.feature @@ -67,7 +67,7 @@ Feature: Report and Moderate And I am logged in When I click on the avatar menu in the top right corner And I click on "Moderation" - Then I see all the reported posts including the one from above + Then I see all the reported posts including from the user who blocked me And each list item links to the post page Scenario: Normal user can't see the moderation page