mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-02-06 09:55:50 +00:00
Update Post query for blockedByUsers
- Admin/Moderators see Posts even if they are blocked
This commit is contained in:
parent
13ba93eecd
commit
8aa7f376b6
@ -30,6 +30,7 @@ export const getBlockedByUsers = async context => {
|
|||||||
.relationship(userModel.relationships().get('blocked'))
|
.relationship(userModel.relationships().get('blocked'))
|
||||||
.to('blocked', userModel)
|
.to('blocked', userModel)
|
||||||
.where('blocked.id', context.user.id)
|
.where('blocked.id', context.user.id)
|
||||||
|
.where('blocked.user', 'user')
|
||||||
.return('user')
|
.return('user')
|
||||||
blockedByUsers = await blockedByUsers.execute()
|
blockedByUsers = await blockedByUsers.execute()
|
||||||
blockedByUsers = blockedByUsers.records.map(r => r.get('user').properties)
|
blockedByUsers = blockedByUsers.records.map(r => r.get('user').properties)
|
||||||
|
|||||||
@ -143,3 +143,12 @@ Then('each list item links to the post page', () => {
|
|||||||
cy.contains(davidIrvingPostTitle).click()
|
cy.contains(davidIrvingPostTitle).click()
|
||||||
cy.location('pathname').should('contain', '/post')
|
cy.location('pathname').should('contain', '/post')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
When("they have a post someone has reported", () => {
|
||||||
|
cy.factory()
|
||||||
|
.create("Post", {
|
||||||
|
authorId: 'annnoying-user',
|
||||||
|
title,
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|||||||
@ -410,6 +410,21 @@ Given("there is an annoying user called {string}", name => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Given("there is an annoying user who has blocked me", () => {
|
||||||
|
cy.login({ email: 'i-blocked-a-moderator-ha-ha-ha@example.org', password: '1234' })
|
||||||
|
.neode()
|
||||||
|
.first("User", {
|
||||||
|
role: 'moderator'
|
||||||
|
})
|
||||||
|
.then(blocked => {
|
||||||
|
cy.neode()
|
||||||
|
.first("User", {
|
||||||
|
name
|
||||||
|
})
|
||||||
|
.relateTo(blocked, "blocked");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Given("I am on the profile page of the annoying user", name => {
|
Given("I am on the profile page of the annoying user", name => {
|
||||||
cy.openPage("/profile/annoying-user/spammy-spammer");
|
cy.openPage("/profile/annoying-user/spammy-spammer");
|
||||||
});
|
});
|
||||||
|
|||||||
@ -8,13 +8,15 @@ Feature: Report and Moderate
|
|||||||
So I can look into it and decide what to do
|
So I can look into it and decide what to do
|
||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given we have this user in our database:
|
Given we have the following user accounts:
|
||||||
| id | name |
|
| id | name | email | password |
|
||||||
| u67 | David Irving|
|
| u67 | David Irving | david-irving@example.org | 1234 |
|
||||||
Given we have the following posts in our database:
|
| annoying-user | I'm gonna block Moderators and Admins HA HA HA | i-blocked-a-moderator-ha-ha-ha@example.org | 1234 |
|
||||||
| authorId | id | title | content |
|
|
||||||
| u67 | p1 | The Truth about the Holocaust | It never existed! |
|
|
||||||
|
|
||||||
|
Given we have the following posts in our database:
|
||||||
|
| authorId | id | title | content |
|
||||||
|
| u67 | p1 | The Truth about the Holocaust | It never existed! |
|
||||||
|
| annoying-user | p2 | Fake news | This content is demonstratably infactual in some way |
|
||||||
Scenario Outline: Report a post from various pages
|
Scenario Outline: Report a post from various pages
|
||||||
Given I am logged in with a "user" role
|
Given I am logged in with a "user" role
|
||||||
When I see David Irving's post on the <Page>
|
When I see David Irving's post on the <Page>
|
||||||
@ -56,6 +58,18 @@ Feature: Report and Moderate
|
|||||||
Then I see all the reported posts including the one from above
|
Then I see all the reported posts including the one from above
|
||||||
And each list item links to the post page
|
And each list item links to the post page
|
||||||
|
|
||||||
|
Scenario: Even if a user has blocked me, I can see their reported posts
|
||||||
|
Given somebody reported the following posts:
|
||||||
|
| id |
|
||||||
|
| p2 |
|
||||||
|
And my user account has the role "moderator"
|
||||||
|
And there is an annoying user who has blocked me
|
||||||
|
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
|
||||||
|
And each list item links to the post page
|
||||||
|
|
||||||
Scenario: Normal user can't see the moderation page
|
Scenario: Normal user can't see the moderation page
|
||||||
Given I am logged in with a "user" role
|
Given I am logged in with a "user" role
|
||||||
When I click on the avatar menu in the top right corner
|
When I click on the avatar menu in the top right corner
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user