mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Display unblock feature only for blocking user
- add hasBlocked query to check if userA initiated the blocking and, if true, only them to unblock userB. - add cypress tests to make sure we don't break this in the future.
This commit is contained in:
parent
403376418f
commit
3b29d480e3
@ -68,7 +68,12 @@ type User {
|
|||||||
RETURN COUNT(u) >= 1
|
RETURN COUNT(u) >= 1
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
hasBlocked: Boolean! @cypher(
|
||||||
|
statement: """
|
||||||
|
MATCH (this)<-[:BLOCKED]-(user:User {id: $cypherParams.currentUserId})
|
||||||
|
RETURN COUNT(user) >= 1
|
||||||
|
"""
|
||||||
|
)
|
||||||
blocked: Boolean! @cypher(
|
blocked: Boolean! @cypher(
|
||||||
statement: """
|
statement: """
|
||||||
MATCH (this)-[:BLOCKED]-(user:User {id: $cypherParams.currentUserId})
|
MATCH (this)-[:BLOCKED]-(user:User {id: $cypherParams.currentUserId})
|
||||||
|
|||||||
@ -558,6 +558,20 @@ When("I block the user {string}", name => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
When("a user has blocked me", () => {
|
||||||
|
cy.neode()
|
||||||
|
.first("User", {
|
||||||
|
name: narratorParams.name
|
||||||
|
})
|
||||||
|
.then(blockedUser => {
|
||||||
|
cy.neode()
|
||||||
|
.first("User", {
|
||||||
|
name: 'Harassing User'
|
||||||
|
})
|
||||||
|
.relateTo(blockedUser, "blocked");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
When("I log in with:", table => {
|
When("I log in with:", table => {
|
||||||
const [firstRow] = table.hashes();
|
const [firstRow] = table.hashes();
|
||||||
const {
|
const {
|
||||||
@ -583,4 +597,20 @@ Then("they should not see the comment from", () => {
|
|||||||
|
|
||||||
Then("they should see a text explaining commenting is not possible", () => {
|
Then("they should see a text explaining commenting is not possible", () => {
|
||||||
cy.get('.ds-placeholder').should('contain', "Commenting is not possible at this time on this post.")
|
cy.get('.ds-placeholder').should('contain', "Commenting is not possible at this time on this post.")
|
||||||
|
})
|
||||||
|
|
||||||
|
Then("I should see no users in my blocked users list", () => {
|
||||||
|
cy.get('.ds-placeholder')
|
||||||
|
.should('contain', "So far, you have not blocked anybody.")
|
||||||
|
})
|
||||||
|
|
||||||
|
Then("I should not see {string} from the content menu in the user info box", link => {
|
||||||
|
cy.get(".user-content-menu .base-button").click()
|
||||||
|
cy.get(".popover .ds-menu-item-link")
|
||||||
|
.should('not.contain', link)
|
||||||
|
})
|
||||||
|
|
||||||
|
Then('I should not see {string} button', button => {
|
||||||
|
cy.get('.ds-card-content')
|
||||||
|
.should('not.contain', '.action-buttons')
|
||||||
})
|
})
|
||||||
@ -44,3 +44,14 @@ Feature: Block a User
|
|||||||
Then I should see the following posts in the select dropdown:
|
Then I should see the following posts in the select dropdown:
|
||||||
| title |
|
| title |
|
||||||
| previously created post |
|
| previously created post |
|
||||||
|
|
||||||
|
Scenario: Blocked users cannot see they are blocked in their list
|
||||||
|
Given a user has blocked me
|
||||||
|
And I navigate to my "Blocked users" settings page
|
||||||
|
Then I should see no users in my blocked users list
|
||||||
|
|
||||||
|
Scenario: Blocked users should not see link or button to unblock, only blocking users
|
||||||
|
Given a user has blocked me
|
||||||
|
When I visit the profile page of the annoying user
|
||||||
|
And I should not see "Unblock user" from the content menu in the user info box
|
||||||
|
And I should not see "Unblock user" button
|
||||||
@ -172,7 +172,7 @@ export default {
|
|||||||
icon: 'microphone-slash',
|
icon: 'microphone-slash',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (this.resource.blocked) {
|
if (this.resource.hasBlocked) {
|
||||||
routes.push({
|
routes.push({
|
||||||
label: this.$t(`settings.blocked-users.unblock`),
|
label: this.$t(`settings.blocked-users.unblock`),
|
||||||
callback: () => {
|
callback: () => {
|
||||||
|
|||||||
@ -67,14 +67,14 @@
|
|||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
</ds-flex>
|
</ds-flex>
|
||||||
<div v-if="!myProfile" class="action-buttons">
|
<div v-if="!myProfile" class="action-buttons">
|
||||||
<base-button v-if="user.blocked" @click="unblockUser(user)">
|
<base-button v-if="user.hasBlocked" @click="unblockUser(user)">
|
||||||
{{ $t('settings.blocked-users.unblock') }}
|
{{ $t('settings.blocked-users.unblock') }}
|
||||||
</base-button>
|
</base-button>
|
||||||
<base-button v-if="user.isMuted" @click="unmuteUser(user)">
|
<base-button v-if="user.isMuted" @click="unmuteUser(user)">
|
||||||
{{ $t('settings.muted-users.unmute') }}
|
{{ $t('settings.muted-users.unmute') }}
|
||||||
</base-button>
|
</base-button>
|
||||||
<hc-follow-button
|
<hc-follow-button
|
||||||
v-if="!(user.blocked || user.isMuted)"
|
v-if="!(user.hasBlocked || user.isMuted)"
|
||||||
:follow-id="user.id"
|
:follow-id="user.id"
|
||||||
:is-followed="user.followedByCurrentUser"
|
:is-followed="user.followedByCurrentUser"
|
||||||
@optimistic="optimisticFollow"
|
@optimistic="optimisticFollow"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user