mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
fix cypher to have signup verification to block posts of groups for new users
This commit is contained in:
parent
275d196cb6
commit
03434071b4
@ -19,6 +19,7 @@ export const signupVerificationMutation = gql`
|
|||||||
nonce: $nonce
|
nonce: $nonce
|
||||||
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
|
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
|
||||||
) {
|
) {
|
||||||
|
id
|
||||||
slug
|
slug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,19 +72,19 @@ const signupCypher = (inviteCode) => {
|
|||||||
(inviteCode:InviteCode {code: $inviteCode})<-[:GENERATED]-(host:User)
|
(inviteCode:InviteCode {code: $inviteCode})<-[:GENERATED]-(host:User)
|
||||||
`
|
`
|
||||||
optionalMerge = `
|
optionalMerge = `
|
||||||
MERGE(user)-[:REDEEMED { createdAt: toString(datetime()) }]->(inviteCode)
|
MERGE (user)-[:REDEEMED { createdAt: toString(datetime()) }]->(inviteCode)
|
||||||
MERGE(host)-[:INVITED { createdAt: toString(datetime()) }]->(user)
|
MERGE (host)-[:INVITED { createdAt: toString(datetime()) }]->(user)
|
||||||
MERGE(user)-[:FOLLOWS { createdAt: toString(datetime()) }]->(host)
|
MERGE (user)-[:FOLLOWS { createdAt: toString(datetime()) }]->(host)
|
||||||
MERGE(host)-[:FOLLOWS { createdAt: toString(datetime()) }]->(user)
|
MERGE (host)-[:FOLLOWS { createdAt: toString(datetime()) }]->(user)
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
const cypher = `
|
const cypher = `
|
||||||
MATCH(email:EmailAddress {nonce: $nonce, email: $email})
|
MATCH (email:EmailAddress {nonce: $nonce, email: $email})
|
||||||
WHERE NOT (email)-[:BELONGS_TO]->()
|
WHERE NOT (email)-[:BELONGS_TO]->()
|
||||||
${optionalMatch}
|
${optionalMatch}
|
||||||
CREATE (user:User)
|
CREATE (user:User)
|
||||||
MERGE(user)-[:PRIMARY_EMAIL]->(email)
|
MERGE (user)-[:PRIMARY_EMAIL]->(email)
|
||||||
MERGE(user)<-[:BELONGS_TO]-(email)
|
MERGE (user)<-[:BELONGS_TO]-(email)
|
||||||
${optionalMerge}
|
${optionalMerge}
|
||||||
SET user += $args
|
SET user += $args
|
||||||
SET user.id = randomUUID()
|
SET user.id = randomUUID()
|
||||||
@ -95,6 +95,13 @@ const signupCypher = (inviteCode) => {
|
|||||||
SET user.showShoutsPublicly = false
|
SET user.showShoutsPublicly = false
|
||||||
SET user.sendNotificationEmails = true
|
SET user.sendNotificationEmails = true
|
||||||
SET email.verifiedAt = toString(datetime())
|
SET email.verifiedAt = toString(datetime())
|
||||||
|
WITH user
|
||||||
|
OPTIONAL MATCH (post:Post)-[:IN]->(group:Group)
|
||||||
|
WHERE NOT group.groupType = 'public'
|
||||||
|
WITH user, collect(post) AS invisiblePosts
|
||||||
|
FOREACH (invisiblePost IN invisiblePosts |
|
||||||
|
MERGE (user)-[:CANNOT_SEE]->(invisiblePost)
|
||||||
|
)
|
||||||
RETURN user {.*}
|
RETURN user {.*}
|
||||||
`
|
`
|
||||||
return cypher
|
return cypher
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user